]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-fs-util: fix memleak 4889/head
authorEvgeny Vereshchagin <evvers@ya.ru>
Wed, 14 Dec 2016 00:31:53 +0000 (00:31 +0000)
committerEvgeny Vereshchagin <evvers@ya.ru>
Wed, 14 Dec 2016 00:31:53 +0000 (00:31 +0000)
Fixes:
```
$ ./libtool --mode=execute valgrind --leak-check=full ./test-fs-util
...
==22871==
==22871== 27 bytes in 1 blocks are definitely lost in loss record 1 of 1
==22871==    at 0x4C2FC47: realloc (vg_replace_malloc.c:785)
==22871==    by 0x4E86D05: strextend (string-util.c:726)
==22871==    by 0x4E8F347: chase_symlinks (fs-util.c:712)
==22871==    by 0x109EBF: test_chase_symlinks (test-fs-util.c:75)
==22871==    by 0x10C381: main (test-fs-util.c:305)
==22871==
```
Closes #4888

src/test/test-fs-util.c

index b502cd0ad181909c94be5982b9cd2cb78935f299..ae68587be9f594c07cd53d28d450c99fe96e34b3 100644 (file)
@@ -78,6 +78,7 @@ static void test_chase_symlinks(void) {
 
         assert_se(mkdir(q, 0700) >= 0);
 
+        result = mfree(result);
         r = chase_symlinks(p, temp, 0, &result);
         assert_se(r > 0);
         assert_se(path_equal(result, q));