From f796e85856382b6beba5c108d74ecf9baf8bb773 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 23 Feb 2024 10:38:06 +0100 Subject: 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 Signed-off-by: Sander Vrijders --- src/ipcpd/common/connmgr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') 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; } -- cgit v1.2.3