summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody P Schafer <dev@codyps.com>2015-08-16 18:54:37 -0400
committerRusty Russell <rusty@rustcorp.com.au>2015-08-17 11:59:43 +0930
commitd88372302ac7d1b5e6d6def90df16c3b9fcd8a4f (patch)
tree3adb4f9dcfd4bd71c58a6617f966289e52d1a546
parent284b3e6d2db0a20d16a7f82f5b1981712b2fd2df (diff)
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: Cody P Schafer <dev@codyps.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (split off leak change)
-rw-r--r--tools/configurator/configurator.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c
index f4edb8ee..a162ee67 100644
--- a/tools/configurator/configurator.c
+++ b/tools/configurator/configurator.c
@@ -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++)