summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2015-08-27 11:04:57 +0100
committerTom Hacohen <tom@stosb.com>2015-08-27 11:07:04 +0100
commita3cc5810cbc6878e9aa458688d0fb8e397fd4d9e (patch)
treee37946903568724cf8770730643ff445f561c58d
parented2f077d6f2a46dd009b380510d9693e0604f770 (diff)
edje: Fix double free scenario caused by static pointer.
Summary: The result of evas_object_textblock_cursor_content_get() API has to be cleaned by outside. _edje_entry_cursor_content_get() is calling free() inside of the function for handle the result using static pointer. But, the caller of _edje_entry_cursor_content_get() is already handling the result using free(). It can cause double free problem. The bigger issue is in elementary. See elm_entry_cursor_content_get() API's document. The document advice developers to free the result when it is done. @fix Test Plan: N/A Reviewers: tasn, raster, woohyun Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2991
-rw-r--r--src/lib/edje/edje_entry.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index 4a57d566b0..deeac86ce4 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -3854,18 +3854,11 @@ _edje_entry_cursor_is_visible_format_get(Edje_Real_Part *rp, Edje_Cursor cur)
3854char * 3854char *
3855_edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur) 3855_edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur)
3856{ 3856{
3857 static char *s = NULL;
3858 Evas_Textblock_Cursor *c = _cursor_get(rp, cur); 3857 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
3859 3858
3860 if (!c) return NULL; 3859 if (!c) return NULL;
3861 if (s)
3862 {
3863 free(s);
3864 s = NULL;
3865 }
3866 3860
3867 s = evas_textblock_cursor_content_get(c); 3861 return evas_textblock_cursor_content_get(c);
3868 return s;
3869} 3862}
3870 3863
3871void 3864void