Skip to content

Commit 96c1655

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 49eb597 commit 96c1655

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

builtin/credential.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,7 @@ int cmd_credential(int argc, const char **argv, const char *prefix UNUSED)
3939
} else {
4040
usage(usage_msg);
4141
}
42+
43+
credential_clear(&c);
4244
return 0;
4345
}

t/t0300-credentials.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22

33
test_description='basic credential helper tests'
4+
5+
TEST_PASSES_SANITIZE_LEAK=true
46
. ./test-lib.sh
57
. "$TEST_DIRECTORY"/lib-credential.sh
68

0 commit comments

Comments
 (0)