Fix the exception handling about creating type handle 79/124879/2
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 13 Apr 2017 01:46:26 +0000 (10:46 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Thu, 13 Apr 2017 12:18:04 +0000 (05:18 -0700)
Change-Id: I5daaa5a488909929d77c1ece677d4dc40667bbbd
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c

index ea1d1ad..7dc3cec 100644 (file)
@@ -79,15 +79,19 @@ EXPORT_API int screen_connector_toolkit_evas_init(Evas_Object *win, screen_conne
 
        type_h = g_hash_table_lookup(__type_table, GINT_TO_POINTER(type));
        if (type_h == NULL) {
-
                type_h = (screen_connector_type_evas_h)calloc(1, sizeof(struct _screen_connector_type_evas_h));
-               g_hash_table_insert(__type_table, GINT_TO_POINTER(type), type_h);
+               if (type_h == NULL) {
+                       LOGE("Out of memory");
+                       return -1;
+               }
 
                type_h->toolkit_table = g_hash_table_new(g_direct_hash, g_direct_equal);
                if (!type_h->toolkit_table) {
                        LOGE("failed to create table");
+                       free(type_h);
                        return -1;
                }
+               g_hash_table_insert(__type_table, GINT_TO_POINTER(type), type_h);
        }
 
        type_h->viewer_win = win;