Skip to content

Commit d06e3ec

Browse files
pks-tgitster
authored andcommitted
builtin/tag: fix leaking key ID on failure to sign
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1a99173 commit d06e3ec

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

builtin/tag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static int do_sign(struct strbuf *buffer, struct object_id **compat_oid,
164164
int ret = -1;
165165

166166
if (sign_buffer(buffer, &sig, keyid))
167-
return -1;
167+
goto out;
168168

169169
if (compat) {
170170
const struct git_hash_algo *algo = the_repository->hash_algo;

t/t7004-tag.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Tests for operations with tags.'
1010
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
1111
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1212

13+
TEST_PASSES_SANITIZE_LEAK=true
1314
. ./test-lib.sh
1415
. "$TEST_DIRECTORY"/lib-gpg.sh
1516
. "$TEST_DIRECTORY"/lib-terminal.sh

0 commit comments

Comments
 (0)