Commit 3c65e082 authored by David Gibson's avatar David Gibson

failtest: Remove memory leak

Somewhat ironically, a path in failtest related to detecting leaks in the
tested program itself leaks memory.  This corrects it.

Detected by Coverity.
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent 4e94428e
...@@ -613,8 +613,10 @@ static NORETURN void failtest_cleanup(bool forced_cleanup, int status) ...@@ -613,8 +613,10 @@ static NORETURN void failtest_cleanup(bool forced_cleanup, int status)
/* But their program shouldn't leak, even on failure. */ /* But their program shouldn't leak, even on failure. */
if (!forced_cleanup && i->can_leak) { if (!forced_cleanup && i->can_leak) {
char *p = failpath_string();
printf("Leak at %s:%u: --failpath=%s\n", printf("Leak at %s:%u: --failpath=%s\n",
i->file, i->line, failpath_string()); i->file, i->line, p);
free(p);
status = 1; status = 1;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment