diff options
author | Andreas Schneider <asn@samba.org> | 2021-04-22 15:03:25 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2021-04-25 21:17:31 +0000 |
commit | dca03ffa8ab682a2705da8cb25cab899338a1375 (patch) | |
tree | df161fa424d51096f7baf70709f419870664b8eb /lib/replace/tests | |
parent | 2e973ea5f1392e7644b5d0706a34a7cae7bb7141 (diff) | |
download | samba-dca03ffa8ab682a2705da8cb25cab899338a1375.tar.gz |
lib:replace: Fix a memleak in test_strdup()
Found by covscan
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/replace/tests')
-rw-r--r-- | lib/replace/tests/testsuite.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/replace/tests/testsuite.c b/lib/replace/tests/testsuite.c index 2ece95332d2..6d87b8ed611 100644 --- 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); |