git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2e973ea
)
lib:replace: Fix a memleak in test_strdup()
author
Andreas Schneider
<asn@samba.org>
Thu, 22 Apr 2021 13:03:25 +0000
(15:03 +0200)
committer
Jeremy Allison
<jra@samba.org>
Sun, 25 Apr 2021 21:17:31 +0000
(21:17 +0000)
Found by covscan
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/replace/tests/testsuite.c
patch
|
blob
|
history
diff --git
a/lib/replace/tests/testsuite.c
b/lib/replace/tests/testsuite.c
index 2ece95332d23ec74ef962025187dda01f566deda..6d87b8ed61160fc3bb742901fb9e8133fc80b78b 100644
(file)
--- a/
lib/replace/tests/testsuite.c
+++ b/
lib/replace/tests/testsuite.c
@@
-164,11
+164,16
@@
static int test_memmove(void)
static int test_strdup(void)
{
char *x;
+ int cmp;
+
printf("test: strdup\n");
x = strdup("bla");
- if (strcmp("bla", x) != 0) {
+
+ cmp = strcmp("bla", x);
+ if (cmp != 0) {
printf("failure: strdup [\nfailed: expected \"bla\", got \"%s\"\n]\n",
x);
+ free(x);
return false;
}
free(x);