builtin/credential-store: fix leaking credential

We never free credentials read by the credential store, leading to a
memory leak. Plug it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Patrick Steinhardt 2024-08-01 12:40:31 +02:00 committed by Junio C Hamano
parent 11d6a81c01
commit 1d615afa8d
3 changed files with 4 additions and 0 deletions

View File

@ -218,5 +218,6 @@ int cmd_credential_store(int argc, const char **argv, const char *prefix)
; /* Ignore unknown operation. */

string_list_clear(&fns, 0);
credential_clear(&c);
return 0;
}

View File

@ -1,6 +1,8 @@
#!/bin/sh

test_description='credential-store tests'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-credential.sh


View File

@ -29,6 +29,7 @@ you can set GIT_TEST_CREDENTIAL_HELPER_SETUP to a sequence of shell
commands.
'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-credential.sh