jackdanielz pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=e025c1a93afb6acb9cf2f0a394cf73e3fcec87c1

commit e025c1a93afb6acb9cf2f0a394cf73e3fcec87c1
Author: Daniel Hirt <daniel.h...@samsung.com>
Date:   Tue Feb 4 15:02:54 2014 +0200

    elm cnp: fix freeing selection buf
    
    Moved a misplaced ELM_SAFE_FREE of the selection buffer,
     as valgrind still showed lost bytes with selection.
---
 src/lib/elm_cnp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index a23562f..f488003 100644
--- a/src/lib/elm_cnp.c
+++ b/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;
 }

-- 


Reply via email to