devilhorns pushed a commit to branch master.

commit 5969c97f7a536923485f4305e923ec8d458341a2
Author: Chris Michael <[email protected]>
Date:   Mon Jul 8 12:17:58 2013 +0100

    Fix memleaks reported by Coverity: ecore_x_window_prop_property_get
    allocates space for 'data'. We need to free that if we are going to
    return before using it.
    
    NB: Fixes Coverity CID1039270
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/lib/ecore_x/xlib/ecore_x_events.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/lib/ecore_x/xlib/ecore_x_events.c 
b/src/lib/ecore_x/xlib/ecore_x_events.c
index a3ebfc3..5519d25 100644
--- a/src/lib/ecore_x/xlib/ecore_x_events.c
+++ b/src/lib/ecore_x/xlib/ecore_x_events.c
@@ -1415,6 +1415,7 @@ _ecore_x_event_handle_selection_notify(XEvent *xevent)
                                selection,
                                xevent->xselection.requestor,
                                CurrentTime);
+             if (data) free(data);
              return;
           }
      }
@@ -1426,7 +1427,10 @@ _ecore_x_event_handle_selection_notify(XEvent *xevent)
 
    e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify));
    if (!e)
-     return;
+     {
+        if (data) free(data);
+        return;
+     }
 
    e->win = xevent->xselection.requestor;
    e->time = xevent->xselection.time;

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to