From 52158e73fa74d7b9274846fad72cc7c557abcacb Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Tue, 30 Jun 2026 14:02:06 +0200 Subject: [PATCH] libekmfweb: Fix invalid free in error path of parse_json_web_token() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't attempt to free the local function parameter 'signature', but the memory where *signature points to. Assisted-by: IBM Bob:2.0.0 Signed-off-by: Ingo Franzki Reviewed-by: Finn Callies Signed-off-by: Jan Höppner --- libekmfweb/utilities.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libekmfweb/utilities.c b/libekmfweb/utilities.c index 1ccf934b..e9f308ec 100644 --- a/libekmfweb/utilities.c +++ b/libekmfweb/utilities.c @@ -366,9 +366,9 @@ out: *payload_obj = pld; else json_object_put(pld); - if (signature != NULL && rc != 0) { - free(signature); - signature = NULL; + if (signature != NULL && *signature != NULL && rc != 0) { + free(*signature); + *signature = NULL; *signature_len = 0; } if (json != NULL)