]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
swanctl: Fix memory leak in --load-creds if --clear fails
authorTobias Brunner <tobias@strongswan.org>
Tue, 4 Mar 2025 13:30:35 +0000 (14:30 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 4 Mar 2025 13:30:35 +0000 (14:30 +0100)
src/swanctl/commands/load_creds.c

index 78487350cf451f5cd7e5629182f086c469b5c407..3fc38456b7a12f41af578e2bbe1868a80a92e7b1 100644 (file)
@@ -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;
                }
        }