builtin/credential: clear credential before exit

We never release memory associated with `struct credential`. Fix this
and mark the corresponding test as leak free.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt 2024-05-27 13:46:49 +02:00 committed by Junio C Hamano
parent 49eb597ce0
commit 96c1655095
2 changed files with 4 additions and 0 deletions

View file

@ -39,5 +39,7 @@ int cmd_credential(int argc, const char **argv, const char *prefix UNUSED)
} else {
usage(usage_msg);
}
credential_clear(&c);
return 0;
}

View file

@ -1,6 +1,8 @@
#!/bin/sh
test_description='basic credential helper tests'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-credential.sh