devilhorns pushed a commit to branch master.

commit e6088e2361cfbabf5feab03611c6650d55036329
Author: Chris Michael <[email protected]>
Date:   Mon Jul 8 11:44:23 2013 +0100

    Fix memleak reported by Coverity: If we are going to error out when
    getting window netwm types, then free any atoms returned by
    prop_atom_list_get.
    
    NB: Fixes Coverity CID1039265
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/lib/ecore_x/xlib/ecore_x_netwm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lib/ecore_x/xlib/ecore_x_netwm.c 
b/src/lib/ecore_x/xlib/ecore_x_netwm.c
index a8dc92c..40741a1 100644
--- a/src/lib/ecore_x/xlib/ecore_x_netwm.c
+++ b/src/lib/ecore_x/xlib/ecore_x_netwm.c
@@ -1237,7 +1237,10 @@ ecore_x_netwm_window_types_get(Ecore_X_Window win,
 
    atoms2 = malloc(num * sizeof(Ecore_X_Window_Type));
    if (!atoms2)
-     return 0;
+     {
+        if (atoms) free(atoms);
+        return 0;
+     }
 
    for (i = 0; i < num; i++)
      atoms2[i] = _ecore_x_netwm_window_type_type_get(atoms[i]);

-- 

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

Build for Windows Store.

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

Reply via email to