ecore_wayland: fix dereference null pointer while creating ecore_wl_window 01/49401/1
authorGwanglim Lee <gl77.lee@samsung.com>
Tue, 13 Oct 2015 05:13:38 +0000 (14:13 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Tue, 13 Oct 2015 05:13:38 +0000 (14:13 +0900)
Change-Id: Ie6bddb77705bfc83c0aa1c9f1ce702853e00ae4d

src/lib/ecore_wayland/ecore_wl_window.c

index 3617f4e..61c731f 100644 (file)
@@ -101,6 +101,7 @@ ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buf
 {
    Ecore_Wl_Window *win;
    static int _win_id = 1;
+   struct wl_compositor *wlcomp;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
@@ -131,11 +132,19 @@ ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buf
    win->opaque.w = w;
    win->opaque.h = h;
 
+   wlcomp = _ecore_wl_compositor_get();
+   if (!wlcomp)
+     {
+        ERR("Failed to get wl_compositor");
+        free(win);
+        return NULL;
+     }
+
    win->opaque_region = 
-     wl_compositor_create_region(_ecore_wl_compositor_get());
+     wl_compositor_create_region(wlcomp);
 
    win->input_region = 
-     wl_compositor_create_region(_ecore_wl_compositor_get());
+     wl_compositor_create_region(wlcomp);
 
    win->title = NULL;
    win->class_name = NULL;