From: Hwankyu Jhun Date: Thu, 13 Apr 2017 01:46:26 +0000 (+0900) Subject: Fix the exception handling about creating type handle X-Git-Tag: accepted/tizen/unified/20170414.163914~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F79%2F124879%2F2;p=platform%2Fcore%2Fappfw%2Fscreen-connector.git Fix the exception handling about creating type handle Change-Id: I5daaa5a488909929d77c1ece677d4dc40667bbbd Signed-off-by: Hwankyu Jhun --- diff --git a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c index ea1d1ad..7dc3cec 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -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;