summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r--src/ipcpd/normal/connmgr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ipcpd/normal/connmgr.c b/src/ipcpd/normal/connmgr.c
index b97d2b23..b8314917 100644
--- a/src/ipcpd/normal/connmgr.c
+++ b/src/ipcpd/normal/connmgr.c
@@ -328,7 +328,7 @@ int connmgr_alloc(struct ae * ae,
int connmgr_wait(struct ae * ae,
struct conn * conn)
{
- struct ae_conn * ae_conn;
+ struct ae_conn * ae_conn = NULL;
assert(ae);
assert(conn);
@@ -341,6 +341,8 @@ int connmgr_wait(struct ae * ae,
while (list_is_empty(&ae->conn_list))
pthread_cond_wait(&ae->conn_cond, &ae->conn_lock);
+ pthread_cleanup_pop(false);
+
ae_conn = list_first_entry((&ae->conn_list), struct ae_conn, next);
if (ae_conn == NULL) {
pthread_mutex_unlock(&ae->conn_lock);
@@ -352,7 +354,7 @@ int connmgr_wait(struct ae * ae,
list_del(&ae_conn->next);
free(ae_conn);
- pthread_cleanup_pop(true);
+ pthread_mutex_unlock(&ae->conn_lock);
return 0;
}