summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-03-22 16:55:43 +0100
committerdimitri staessens <dimitri.staessens@ugent.be>2017-03-22 16:55:43 +0100
commit7871c6fce718274abbd467912f1ec591f9115714 (patch)
treec4433889ba3fc6d5e53b164068d772c9f4bee09f /src/ipcpd/normal
parent79090eb2fc0fe4f6582aca556c05435dace60046 (diff)
downloadouroboros-7871c6fce718274abbd467912f1ec591f9115714.tar.gz
ouroboros-7871c6fce718274abbd467912f1ec591f9115714.zip
ipcpd: Fix cleanup handler in connmgr
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;
}