Generally, we do not free stuff in the tests (because we don't care
about any leaks), but I wanted to see a clear valgrind result on this
one...
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
}
static int test_string_replace(const struct test* t) {
- const char* result = pakfire_string_replace(
+ int r = EXIT_FAILURE;
+
+ char* result = pakfire_string_replace(
"ABCABCABCABC", "AB", "CC"
);
ASSERT_STRING_EQUALS(result, "CCCCCCCCCCCC");
- return EXIT_SUCCESS;
+ // Success
+ r = EXIT_SUCCESS;
FAIL:
- return EXIT_FAILURE;
+ if (result)
+ free(result);
+
+ return r;
}
static int test_string_join(const struct test* t) {