library : fix wrong use of mutex lock 20/74120/2 accepted/tizen/common/20160614.143651 accepted/tizen/ivi/20160614.041205 accepted/tizen/mobile/20160614.041112 accepted/tizen/tv/20160614.041150 accepted/tizen/wearable/20160614.041135 submit/tizen/20160613.023047 submit/tizen/20160613.062107
authorJiwoong Im <jiwoong.im@samsung.com>
Mon, 13 Jun 2016 02:11:55 +0000 (11:11 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Mon, 13 Jun 2016 02:27:16 +0000 (19:27 -0700)
Change-Id: I4968b8a7847d759b1d7bc14b7eb2fa8cace0dc29
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
lib/buxton2.c

index 1898eee..5310d2b 100644 (file)
@@ -1652,7 +1652,7 @@ static struct bxt_req *unset_value(struct buxton_client *client,
        if (r == -1) {
                g_hash_table_remove(client->req_cbs,
                                GUINT_TO_POINTER(req->msgid));
-               pthread_mutex_lock(&client->lock);
+               pthread_mutex_unlock(&client->lock);
                return NULL;
        }
 
@@ -2234,17 +2234,17 @@ EXPORT int buxton_open_full(struct buxton_client **client, bool attach_fd,
        cli->req_cbs = g_hash_table_new_full(g_direct_hash, g_direct_equal,
                        NULL, (GDestroyNotify)free_req);
        if (!cli->req_cbs) {
+               pthread_mutex_unlock(&cli->lock);
                free_client(cli);
                errno = ENOMEM;
-               pthread_mutex_unlock(&cli->lock);
                return -1;
        }
        cli->noti_cbs = g_hash_table_new_full(g_str_hash, g_str_equal,
                        NULL, (GDestroyNotify)free_noti);
        if (!cli->noti_cbs) {
+               pthread_mutex_unlock(&cli->lock);
                free_client(cli);
                errno = ENOMEM;
-               pthread_mutex_unlock(&cli->lock);
                return -1;
        }
        pthread_mutex_unlock(&cli->lock);