ecore-wayland: Check return of calloc
authorChris Michael <cp.michael@samsung.com>
Wed, 13 Aug 2014 14:50:04 +0000 (10:50 -0400)
committerChris Michael <cp.michael@samsung.com>
Wed, 1 Oct 2014 20:15:37 +0000 (16:15 -0400)
Calloc 'can' fail so lets check the return and make sure 'global' is
valid else we will segfault.

@fix

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

index 4a634cd..5a21932 100644 (file)
@@ -610,7 +610,7 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry *registry, unsigned in
 
    ewd = data;
 
-   global = calloc(1, sizeof(Ecore_Wl_Global));
+   if (!(global = calloc(1, sizeof(Ecore_Wl_Global)))) return;
 
    global->id = id;
    global->interface = strdup(interface);