Fix memleak reported by Coverity: If we fail to allocate a new
authorChris Michael <cp.michael@samsung.com>
Mon, 8 Jul 2013 10:19:37 +0000 (11:19 +0100)
committerChris Michael <cp.michael@samsung.com>
Mon, 8 Jul 2013 10:19:37 +0000 (11:19 +0100)
internal menu, then free the previously allocated memory for xml file.

NB: Fixed Coverity CID 1039183

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/efreet/efreet_menu.c

index feea57d3eac68cd7a0c8e4ebc5bb4377d0cbe6e0..098f8c79c8a7cd38f7e6fb3d0b1ec51d7fd367c9 100644 (file)
@@ -1452,7 +1452,11 @@ efreet_menu_merge(Efreet_Menu_Internal *parent, Efreet_Xml *xml, const char *pat
     }
 
     internal = efreet_menu_internal_new(parent);
-    if (!internal) return 0;
+    if (!internal)
+    {
+        efreet_xml_del(merge_xml);
+        return 0;
+    }
     efreet_menu_path_set(internal, path);
     efreet_menu_handle_menu(internal, merge_xml);
     efreet_menu_concatenate(parent, internal);