]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
lib/accelerated/x86/sha-padlock.c: Free ctx on error to avoid memory leak
authorJiasheng Jiang <jian1000@purdue.edu>
Mon, 16 Jun 2025 05:22:53 +0000 (05:22 +0000)
committerDaiki Ueno <ueno@gnu.org>
Mon, 16 Jun 2025 05:22:53 +0000 (14:22 +0900)
Call gnutls_free() to release ctx if _ctx_init() fails, preventing a memory leak.

Fixes: 38a089b67 ("Updates for padlock hashes in C7 nano. Requires a part of nettle to be included.")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
lib/accelerated/x86/sha-padlock.c

index 84c2a68a62068b3a3279552e43afc64076b42c40..44e1eabd4b855ec15fb5c353623f5fa85c14a683 100644 (file)
@@ -276,6 +276,7 @@ static int wrap_padlock_hash_init(gnutls_digest_algorithm_t algo, void **_ctx)
        ctx->algo = algo;
 
        if ((ret = _ctx_init(algo, ctx)) < 0) {
+               gnutls_free(ctx);
                gnutls_assert();
                return ret;
        }