diff options
author | Chris Michael <cp.michael@samsung.com> | 2015-01-05 13:48:45 -0500 |
---|---|---|
committer | Chris Michael <cp.michael@samsung.com> | 2015-01-05 13:48:45 -0500 |
commit | 209c058122a478938e2594e72e48d7d5ca09ce70 (patch) | |
tree | 3073c72dba97a8fc2b7994e525d3fa9c81c1f01c | |
parent | a019579fc0b43d97340653e5d16cc13bfe3f758d (diff) | |
download | elementary-209c058122a478938e2594e72e48d7d5ca09ce70.tar.gz |
elementary: Fix issue with event data causing an invalid free
Summary: Since we end up calling free on the event->data parameter
after a drop is completed, we should actually be allocating a string
for this data (to be free'd later). This also fixes an issue where the
event length was not being set.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r-- | src/lib/elm_cnp.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c index 195741861..ee44a3caa 100644 --- a/src/lib/elm_cnp.c +++ b/src/lib/elm_cnp.c @@ -3284,18 +3284,24 @@ _wl_dropable_data_handle(Wl_Cnp_Selection *sel, char *data) Dropable *drop; unsigned int win = 0; Elm_Selection_Data sdata; - static const char *tagstring = - "<item absize=240x180 href=file://%s></item>"; + int len = 0; + char *s = NULL; win = _wl_elm_widget_window_get(sel->requestwidget); drop = _wl_dropable_find_geom(win, savedtypes.x, savedtypes.y); + len = strlen(data); + if (!(s = malloc(len + 1))) return; + memcpy(s, data, len); + s[len] = 0; + if (savedtypes.textreq) { savedtypes.textreq = 0; - savedtypes.imgfile = data; + savedtypes.imgfile = s; } + sdata.len = len; sdata.x = savedtypes.x; sdata.y = savedtypes.y; |