From 41b6a932fe0a0b2a77a840a12cee71e5b8e08038 Mon Sep 17 00:00:00 2001 From: Daniel Hirt Date: Tue, 4 Feb 2014 15:02:54 +0200 Subject: [PATCH] elm cnp: fix freeing selection buf Moved a misplaced ELM_SAFE_FREE of the selection buffer, as valgrind still showed lost bytes with selection. --- legacy/elementary/src/lib/elm_cnp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/legacy/elementary/src/lib/elm_cnp.c b/legacy/elementary/src/lib/elm_cnp.c index a23562f2dd..f4880036c4 100644 --- a/legacy/elementary/src/lib/elm_cnp.c +++ b/legacy/elementary/src/lib/elm_cnp.c @@ -1752,12 +1752,12 @@ _x11_elm_cnp_selection_set(Ecore_X_Window xwin, Evas_Object *obj, Elm_Sel_Type s evas_object_event_callback_add (sel->widget, EVAS_CALLBACK_DEL, _x11_sel_obj_del, sel); + ELM_SAFE_FREE(sel->selbuf, free); if (selbuf) { if (format == ELM_SEL_FORMAT_IMAGE) { // selbuf is actual image data, not text/string - ELM_SAFE_FREE(sel->selbuf, free); sel->selbuf = malloc(buflen + 1); if (!sel->selbuf) { @@ -1770,8 +1770,6 @@ _x11_elm_cnp_selection_set(Ecore_X_Window xwin, Evas_Object *obj, Elm_Sel_Type s else sel->selbuf = strdup((char*)selbuf); } - else - sel->selbuf = NULL; return EINA_TRUE; }