Fix the problems detected by static analyzer 30/63830/1
authorGwanglim Lee <gl77.lee@samsung.com>
Mon, 28 Mar 2016 04:54:31 +0000 (13:54 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Mon, 28 Mar 2016 04:54:31 +0000 (13:54 +0900)
Change-Id: I2bb201921d0ff7cc8757ad89d176c05cbdb76b1e

src/bin/e_client.c
src/bin/e_comp_wl.c
src/bin/e_pixmap.c

index e0541b1dca82dafae70a15ac774eec5034c9f258..8e2e16ba1933f7665f2e703a41bf2226b9acdf70 100644 (file)
@@ -1128,7 +1128,7 @@ _e_client_move_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *even
    return ECORE_CALLBACK_PASS_ON;
 
 stop:
-   _e_client_move_end(action_client);
+   if (action_client) _e_client_move_end(action_client);
    _e_client_action_finish();
    return ECORE_CALLBACK_DONE;
 }
@@ -1141,7 +1141,7 @@ _e_client_move_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev
    if (!action_client)
      ERR("no action_client!");
 
-   _e_client_move_end(action_client);
+   if (action_client) _e_client_move_end(action_client);
    _e_client_action_finish();
    return ECORE_CALLBACK_DONE;
 }
@@ -1379,7 +1379,7 @@ _e_client_resize_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev
    return ECORE_CALLBACK_PASS_ON;
 
 stop:
-   _e_client_resize_end(action_client);
+   if (action_client) _e_client_resize_end(action_client);
    _e_client_action_finish();
    return ECORE_CALLBACK_DONE;
 }
@@ -1392,7 +1392,7 @@ _e_client_resize_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *
    if (!action_client)
      ERR("no action_client!");
 
-   _e_client_resize_end(action_client);
+   if (action_client) _e_client_resize_end(action_client);
    _e_client_action_finish();
    return ECORE_CALLBACK_DONE;
 }
index f16eab92bdf1bd564b8e8938c34f3238d59f05a4..0a45c4aac6f096055686c34d37b069b76581f9fd 100644 (file)
@@ -3477,6 +3477,8 @@ _e_comp_wl_screenshooter_cb_shoot(struct wl_client *client EINA_UNUSED, struct w
    wl_shm_buffer_end_access(shm_buffer);
 
    screenshooter_send_done(resource);
+
+   free(pixels);
 }
 
 static const struct screenshooter_interface _e_screenshooter_interface =
index 648b0c2c5a7a1e04cf003f771840f3a88cf7c9c9..2253e51cb1ebf90082cd7ace59f5b22438d01822 100644 (file)
@@ -312,75 +312,61 @@ e_pixmap_new(E_Pixmap_Type type, ...)
 {
    E_Pixmap *cp = NULL;
    va_list l;
-#ifndef HAVE_WAYLAND_ONLY
-   Ecore_X_Window xwin;
-#endif
-#ifdef HAVE_WAYLAND
    uintptr_t id;
-#endif
 
-   EINA_SAFETY_ON_TRUE_RETURN_VAL((type != E_PIXMAP_TYPE_WL) && (type != E_PIXMAP_TYPE_X), NULL);
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(type != E_PIXMAP_TYPE_WL, NULL);
+
    va_start(l, type);
+
    switch (type)
      {
-      case E_PIXMAP_TYPE_X:
-#ifndef HAVE_WAYLAND_ONLY
-        xwin = va_arg(l, uint32_t);
-        if (pixmaps[type])
-          {
-             cp = eina_hash_find(pixmaps[type], &xwin);
-             if (cp)
-               {
-                  cp->refcount++;
-                  break;
-               }
-          }
-        else
-          pixmaps[type] = eina_hash_int32_new((Eina_Free_Cb)_e_pixmap_free);
-        cp = _e_pixmap_new(type);
-        EINA_SAFETY_ON_NULL_RETURN_VAL(cp, NULL);
-
-        cp->win = xwin;
-        eina_hash_add(pixmaps[type], &xwin, cp);
-#endif
-        break;
       case E_PIXMAP_TYPE_WL:
-#ifdef HAVE_WAYLAND
-        id = va_arg(l, uintptr_t);
-        if (pixmaps[type])
-          {
-             cp = eina_hash_find(pixmaps[type], &id);
-             if (cp)
-               {
-                  cp->refcount++;
-                  break;
-               }
-          }
-        else
-          {
-             pixmaps[type] = eina_hash_pointer_new(NULL);
-             deleted[type] = eina_hash_pointer_new((Eina_Free_Cb)_e_pixmap_free);
-          }
-
-        cp = _e_pixmap_new(type);
-        EINA_SAFETY_ON_NULL_RETURN_VAL(cp, NULL);
 
-        cp->win = id;
-        eina_hash_add(pixmaps[type], &id, cp);
-        uuid_generate(cp->uuid);
+         id = va_arg(l, uintptr_t);
+
+         if (pixmaps[type])
+           {
+              cp = eina_hash_find(pixmaps[type], &id);
+              if (cp)
+                {
+                   cp->refcount++;
+                   break;
+                }
+           }
+         else
+           {
+              pixmaps[type] = eina_hash_pointer_new(NULL);
+              deleted[type] = eina_hash_pointer_new((Eina_Free_Cb)_e_pixmap_free);
+           }
+
+         cp = _e_pixmap_new(type);
+         if (!cp)
+           {
+              va_end(l);
+              ELOGF("PIXMAP", "NEW failed id:%p", NULL, NULL, (void *)id);
+              return NULL;
+           }
+
+         cp->win = id;
+         eina_hash_add(pixmaps[type], &id, cp);
+         uuid_generate(cp->uuid);
+
+         if (!res_ids)
+           res_ids = eina_hash_int32_new(NULL);
+         cp->res_id = res_id;
+         eina_hash_add(res_ids, &res_id, cp);
+         res_id++;
+         ELOG("PIXMAP NEW", cp, cp->client);
+         break;
 
-        if (!res_ids)
-          res_ids = eina_hash_int32_new(NULL);
-        cp->res_id = res_id;
-        eina_hash_add(res_ids, &res_id, cp);
-        res_id++;
-        ELOG("PIXMAP NEW", cp, cp->client);
-#endif
-        break;
-      default: break;
+      default:
+         break;
      }
+
    va_end(l);
+
    _e_pixmap_hook_call(E_PIXMAP_HOOK_NEW, cp);
+
    return cp;
 }