]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin/credential-store: fix leaking credential
authorPatrick Steinhardt <ps@pks.im>
Thu, 1 Aug 2024 10:40:31 +0000 (12:40 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Aug 2024 15:47:36 +0000 (08:47 -0700)
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>
builtin/credential-store.c
t/t0302-credential-store.sh
t/t0303-credential-external.sh

index 494c8093321e1dac30c019d178096efb26050874..97968bfa1c2d81c857016dd53a06bb61e43614f5 100644 (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;
 }
index 716bf1af9fd04e64b7d5c03570b5ba74a8529d46..f83db659e2581444b9a9740df8cefd7fb530c359 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='credential-store tests'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-credential.sh
 
index 72ae405c3ed979edee54cbe83e73ec566d23f6d1..8aadbe86c458560f1e23811db10679c806c5a324 100755 (executable)
@@ -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