Fix double CONN_LOCK call leading to deadlock 92/215492/1
authorNishant Chaprana <n.chaprana@samsung.com>
Wed, 9 Oct 2019 12:23:21 +0000 (17:53 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Wed, 9 Oct 2019 12:23:21 +0000 (17:53 +0530)
Change-Id: I4020c5d80514440899e0d16e05b9170e769bb478
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
packaging/capi-network-connection.spec
src/connection.c

index 71bdb8e..b673b4e 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          capi-network-connection
 Summary:       Network Connection library in TIZEN C API
-Version:       1.0.116
+Version:       1.0.117
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index e53dcb3..61b87cb 100755 (executable)
@@ -209,13 +209,13 @@ EXPORT_API int connection_create_cs(int tid, connection_h *connection)
 {
        int rv;
 
-       CONN_LOCK;
-
        rv = connection_create(connection);
-       if (rv == CONNECTION_ERROR_NONE)
+       if (rv == CONNECTION_ERROR_NONE) {
+               CONN_LOCK;
                _connection_set_cs_tid(tid, *connection);
+               CONN_UNLOCK;
+       }
 
-       CONN_UNLOCK;
        return rv;
 }
 
@@ -224,11 +224,11 @@ EXPORT_API int connection_destroy_cs(int tid, connection_h connection)
        int rv;
 
        CONN_LOCK;
-
        _connection_unset_cs_tid(tid, connection);
+       CONN_UNLOCK;
+
        rv = connection_destroy(connection);
 
-       CONN_UNLOCK;
        return rv;
 }