diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2024-02-23 10:38:06 +0100 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2024-02-23 16:41:37 +0100 |
commit | f796e85856382b6beba5c108d74ecf9baf8bb773 (patch) | |
tree | 4a343ac71abebcef9e87f1e7c64021d267b5de45 /src/ipcpd/common | |
parent | 183208fd113646acbf08973e16ab9224f3f86179 (diff) | |
download | ouroboros-f796e85856382b6beba5c108d74ecf9baf8bb773.tar.gz ouroboros-f796e85856382b6beba5c108d74ecf9baf8bb773.zip |
ipcpd: Clean up connection when cancelling connect
The connection element was not free'd on shutdown during a connect
operation.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/common')
-rw-r--r-- | src/ipcpd/common/connmgr.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ipcpd/common/connmgr.c b/src/ipcpd/common/connmgr.c index 5b1d8c47..71b114aa 100644 --- a/src/ipcpd/common/connmgr.c +++ b/src/ipcpd/common/connmgr.c @@ -332,6 +332,7 @@ int connmgr_ipcp_connect(const char * dst, { struct conn_el * ce; int id; + int ret; assert(dst); assert(component); @@ -348,7 +349,13 @@ int connmgr_ipcp_connect(const char * dst, goto fail_id; } - if (connmgr_alloc(id, dst, &qs, &ce->conn)) { + pthread_cleanup_push(free, ce); + + ret = connmgr_alloc(id, dst, &qs, &ce->conn); + + pthread_cleanup_pop(false); + + if (ret < 0) { log_err("Failed to allocate flow."); goto fail_id; } |