summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWooHyun Jung <wh0705.jung@samsung.com>2014-01-21 21:00:29 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2014-01-21 21:00:29 +0900
commit6d5a1a3d25a671ddb7d6c007596274ceb77ef2e6 (patch)
tree16aa350b747b407d35593a4a591d3e9137985acb
parentb25e2bf0a67d47ce9ec0afa46d23569f49e0b74f (diff)
entry: NULL should be set to the correct position of tmpbuf.
If edje_object_part_text_get gives different text from original one, length of text can be changed. So the last position of tmpbuf should be calculated again refering to the current text to be returned.
-rw-r--r--src/lib/elm_entry.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index 29991b9e6..51d321fd3 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -2829,12 +2829,12 @@ proceed:
2829 if (sd->append_text_len > 0) 2829 if (sd->append_text_len > 0)
2830 { 2830 {
2831 char *tmpbuf; 2831 char *tmpbuf;
2832 size_t tlen; 2832 size_t len, tlen;
2833 2833
2834 tlen = strlen(text); 2834 tlen = strlen(text);
2835 len = tlen + sd->append_text_len - sd->append_text_position;
2835 /* FIXME: need that or we do copy uninitialised data */ 2836 /* FIXME: need that or we do copy uninitialised data */
2836 tmpbuf = calloc(1, tlen + sd->append_text_len - 2837 tmpbuf = calloc(1, len + 1);
2837 sd->append_text_position + 1);
2838 if (!tmpbuf) 2838 if (!tmpbuf)
2839 { 2839 {
2840 ERR("Failed to allocate memory for entry's text %p", obj); 2840 ERR("Failed to allocate memory for entry's text %p", obj);
@@ -2846,7 +2846,7 @@ proceed:
2846 memcpy(tmpbuf + tlen, sd->append_text_left 2846 memcpy(tmpbuf + tlen, sd->append_text_left
2847 + sd->append_text_position, sd->append_text_len 2847 + sd->append_text_position, sd->append_text_len
2848 - sd->append_text_position); 2848 - sd->append_text_position);
2849 tmpbuf[sd->append_text_len] = '\0'; 2849 tmpbuf[len] = '\0';
2850 eina_stringshare_replace(&sd->text, tmpbuf); 2850 eina_stringshare_replace(&sd->text, tmpbuf);
2851 free(tmpbuf); 2851 free(tmpbuf);
2852 } 2852 }