configurator: fix crash when more than one extra test provided
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 5 Feb 2019 04:04:47 +0000 (14:34 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 5 Feb 2019 04:04:47 +0000 (14:34 +1030)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/configurator/configurator.c

index 1386fc90c8d72be6e734eb9f21a2d661b4c6f86c..f15f34483c36352549af73a9facea230ced71bfe 100644 (file)
@@ -888,7 +888,8 @@ static void read_tests(size_t num_tests)
 {
        while (read_test(tests + num_tests)) {
                num_tests++;
-               tests = realloc(tests, num_tests * sizeof(tests[0]));
+               tests = realloc(tests, (num_tests + 1) * sizeof(tests[0]));
+               tests[num_tests].name = NULL;
        }
 }