diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-05-27 13:46:49 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-05-27 11:20:01 -0700 |
| commit | 96c1655095ae21040afe9d9c05cf42bb0fc03581 (patch) | |
| tree | 539d13e8f6337c769dd1d60704eaef9106386ba8 | |
| parent | config: plug various memory leaks (diff) | |
| download | git-96c1655095ae21040afe9d9c05cf42bb0fc03581.tar.gz git-96c1655095ae21040afe9d9c05cf42bb0fc03581.zip | |
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>
| -rw-r--r-- | builtin/credential.c | 2 | ||||
| -rwxr-xr-x | t/t0300-credentials.sh | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/builtin/credential.c b/builtin/credential.c index 5100d441f2..b72e76dd9a 100644 --- a/builtin/credential.c +++ b/builtin/credential.c @@ -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; } diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh index 432f029d48..6a76b7fdbd 100755 --- a/t/t0300-credentials.sh +++ b/t/t0300-credentials.sh @@ -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 |
