]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin/tag: fix leaking key ID on failure to sign
authorPatrick Steinhardt <ps@pks.im>
Tue, 5 Nov 2024 06:17:26 +0000 (07:17 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 Nov 2024 06:37:55 +0000 (22:37 -0800)
We do not free the key ID when signing a tag fails. Do so by using
the common exit path.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/tag.c
t/t7004-tag.sh

index 93d10d59157d2ee1b41f90640bd162917f1eb162..c37c0a68fdaa168af3e53474b5b0a1300191d867 100644 (file)
@@ -164,7 +164,7 @@ static int do_sign(struct strbuf *buffer, struct object_id **compat_oid,
        int ret = -1;
 
        if (sign_buffer(buffer, &sig, keyid))
-               return -1;
+               goto out;
 
        if (compat) {
                const struct git_hash_algo *algo = the_repository->hash_algo;
index b1316e62f46ded39a3c65a78ef465dc5ba8cae0d..42b3327e69bed34ce2c5acafc249fc69360ca022 100755 (executable)
@@ -10,6 +10,7 @@ Tests for operations with tags.'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-gpg.sh
 . "$TEST_DIRECTORY"/lib-terminal.sh