set null after display_wrapper free 88/114988/4
authorJunkyeong Kim <jk0430.kim@samsung.com>
Thu, 16 Feb 2017 04:19:17 +0000 (13:19 +0900)
committerJunkyeong Kim <jk0430.kim@samsung.com>
Thu, 16 Feb 2017 06:37:12 +0000 (15:37 +0900)
Change-Id: Ie4d6257d9c6079b3e58e98e701775d3b140638c6
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/efl_util.c

index 897d291..95d0874 100644 (file)
@@ -308,6 +308,7 @@ _wl_init(void)
 
    reg = wl_display_get_registry(display_wrapper);
    wl_proxy_wrapper_destroy(display_wrapper);
+   display_wrapper = NULL;
    EINA_SAFETY_ON_NULL_GOTO(reg, fail);
 
    wl_registry_add_listener(reg, &_wl_reg_listener, NULL);
@@ -1558,15 +1559,16 @@ efl_util_screenshot_initialize(int width, int height)
         wl_display_roundtrip_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
         display_wrapper = wl_proxy_create_wrapper(_eflutil.wl.dpy);
-        EINA_SAFETY_ON_NULL_GOTO(display_wrapper, fail_init);
+        EINA_SAFETY_ON_NULL_GOTO(display_wrapper, fail_memory);
 
         _eflutil.wl.shot.queue = wl_display_create_queue(_eflutil.wl.dpy);
-        EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.shot.queue, fail_init);
+        EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.shot.queue, fail_memory);
 
         wl_proxy_set_queue((struct wl_proxy *)display_wrapper, _eflutil.wl.shot.queue);
 
         reg = wl_display_get_registry(display_wrapper);
         wl_proxy_wrapper_destroy(display_wrapper);
+        display_wrapper = NULL;
         EINA_SAFETY_ON_NULL_GOTO(reg, fail_init);
 
         wl_registry_add_listener(reg, &_wl_reg_screenshooter_listener, NULL);
@@ -1627,15 +1629,13 @@ fail_memory:
      wl_proxy_wrapper_destroy(display_wrapper);
    set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY);
    return NULL;
-/* LCOV_EXCL_STOP */
 fail_init:
    if (screenshot)
      efl_util_screenshot_deinitialize(screenshot);
    _screenshot_mutex_unlock();
-   if (display_wrapper)
-     wl_proxy_wrapper_destroy(display_wrapper);
    set_last_result(EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL);
    return NULL;
+/* LCOV_EXCL_STOP */
 }
 
 API int