summaryrefslogtreecommitdiff
path: root/src/ipcpd/common
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2024-02-23 10:38:06 +0100
committerSander Vrijders <[email protected]>2024-02-23 16:41:37 +0100
commitf796e85856382b6beba5c108d74ecf9baf8bb773 (patch)
tree4a343ac71abebcef9e87f1e7c64021d267b5de45 /src/ipcpd/common
parent183208fd113646acbf08973e16ab9224f3f86179 (diff)
downloadouroboros-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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/ipcpd/common')
-rw-r--r--src/ipcpd/common/connmgr.c9
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;
}