Commit d8837230 authored by Cody P Schafer's avatar Cody P Schafer Committed by Rusty Russell

configurator: avoid leaks that LeakSanitizer doesn't like

These leaks aren't really an issue since they are completely bounded,
but if one is building with leak sanitizer enabled (as
-fsanitize=address does in gcc-5.1), it kills the configurator, which
isn't very useful for us. Add the few free() calls it's looking for.

This is not an actual code issue, they just workaround
some optional compiler peculiarities.
Signed-off-by: default avatarCody P Schafer <dev@codyps.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (split off leak change)
parent 284b3e6d
......@@ -430,6 +430,9 @@ static bool run_test(const char *cmd, struct test *test)
test->done = true;
return test->answer;
}
if (deps[len])
free(dep);
deps += len;
deps += strspn(deps, " ");
}
......@@ -549,6 +552,7 @@ int main(int argc, const char *argv[])
cmd = connect_args(argv, " -o " OUTPUT_FILE " " INPUT_FILE);
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
run_test(cmd, &tests[i]);
free(cmd);
unlink(OUTPUT_FILE);
unlink(INPUT_FILE);
......@@ -560,7 +564,9 @@ int main(int argc, const char *argv[])
printf("#define _GNU_SOURCE /* Always use GNU extensions. */\n");
printf("#endif\n");
printf("#define CCAN_COMPILER \"%s\"\n", argv[1]);
printf("#define CCAN_CFLAGS \"%s\"\n\n", connect_args(argv+1, ""));
cmd = connect_args(argv+1, "");
printf("#define CCAN_CFLAGS \"%s\"\n\n", cmd);
free(cmd);
/* This one implies "#include <ccan/..." works, eg. for tdb2.h */
printf("#define HAVE_CCAN 1\n");
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
......
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