From e6b9f82a874962e9dd45c6d2c1fce45648e1f4fa Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 4 Mar 2025 14:30:35 +0100 Subject: [PATCH] swanctl: Fix memory leak in --load-creds if --clear fails --- src/swanctl/commands/load_creds.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/swanctl/commands/load_creds.c b/src/swanctl/commands/load_creds.c index 78487350cf..3fc38456b7 100644 --- a/src/swanctl/commands/load_creds.c +++ b/src/swanctl/commands/load_creds.c @@ -903,6 +903,8 @@ int load_creds_cfg(vici_conn_t *conn, command_format_options_t format, { if (!clear_creds(conn, format)) { + ctx.keys->destroy_function(ctx.keys, (void*)free); + ctx.shared->destroy_function(ctx.shared, (void*)free); return ECONNREFUSED; } }