Fix no unlock defect 18/61018/1 accepted/tizen/common/20160304.195112 accepted/tizen/ivi/20160305.091800 accepted/tizen/mobile/20160305.091709 accepted/tizen/tv/20160305.091725 accepted/tizen/wearable/20160305.091744 submit/tizen/20160304.004910
authorHyunho Kang <hhstark.kang@samsung.com>
Thu, 3 Mar 2016 08:57:49 +0000 (17:57 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Thu, 3 Mar 2016 08:58:52 +0000 (17:58 +0900)
Change-Id: I94cb41de0e842324577ea1290b73d85110b355db
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
src/message_port.c

index 3107b09..4ee9e99 100644 (file)
@@ -75,8 +75,10 @@ int message_port_register_local_port(const char *local_port, message_port_messag
                        (message_port_callback_item *)g_hash_table_lookup(__listeners, GINT_TO_POINTER(local_port_id));
                if (item == NULL) {
                        item = (message_port_callback_item *)calloc(1, sizeof(message_port_callback_item));
-                       if (item == NULL)
+                       if (item == NULL) {
+                               pthread_mutex_unlock(&__mutex);
                                return MESSAGE_PORT_ERROR_OUT_OF_MEMORY;
+                       }
 
                        g_hash_table_insert(__listeners, GINT_TO_POINTER(local_port_id), item);
                }
@@ -111,8 +113,10 @@ int message_port_register_trusted_local_port(const char *local_port, message_por
                        (message_port_callback_item *)g_hash_table_lookup(__trusted_listeners, GINT_TO_POINTER(trusted_local_port_id));
                if (item == NULL) {
                        item = (message_port_callback_item *)calloc(1, sizeof(message_port_callback_item));
-                       if (item == NULL)
+                       if (item == NULL) {
+                               pthread_mutex_unlock(&__mutex);
                                return MESSAGE_PORT_ERROR_OUT_OF_MEMORY;
+                       }
 
                        g_hash_table_insert(__trusted_listeners, GINT_TO_POINTER(trusted_local_port_id), item);
                }