From 7871c6fce718274abbd467912f1ec591f9115714 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Wed, 22 Mar 2017 16:55:43 +0100 Subject: ipcpd: Fix cleanup handler in connmgr --- src/ipcpd/normal/connmgr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ipcpd/normal/connmgr.c') 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; } -- cgit v1.2.3