]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/tests_pass_valgrind.c
strsplit: remove nump argument
[ccan] / tools / ccanlint / tests / tests_pass_valgrind.c
index 30a806eb934bd5cf9799a8b74ab5e88c348d1187..4c4338b6c1c6d3ab20ad9e93a61cdf3da8361c78 100644 (file)
@@ -52,11 +52,11 @@ static bool blank_line(const char *line)
 static char *get_leaks(const char *output, char **errs)
 {
        char *leaks = talloc_strdup(output, "");
-       unsigned int i, num;
-       char **lines = strsplit(output, output, "\n", &num);
+       unsigned int i;
+       char **lines = strsplit(output, output, "\n");
 
        *errs = talloc_strdup(output, "");
-       for (i = 0; i < num; i++) {
+       for (i = 0; i < talloc_array_length(lines) - 1; i++) {
                if (strstr(lines[i], " lost ")) {
                        /* A leak... */
                        if (strstr(lines[i], " definitely lost ")) {
@@ -121,6 +121,7 @@ static void do_run_tests_vg(struct manifest *m,
                        output = grab_file(i, "valgrind.log", NULL);
                        if (!output || output[0] == '\0') {
                                err = NULL;
+                               i->leak_info = NULL;
                        } else {
                                i->leak_info = get_leaks(output, &err);
                        }
@@ -193,7 +194,7 @@ REGISTER_TEST(tests_pass_valgrind);
 
 struct ccanlint tests_pass_valgrind_noleaks = {
        .key = "tests_pass_valgrind_noleaks",
-       .name = "Module's run and api tests leak memory",
+       .name = "Module's run and api tests have no memory leaks",
        .check = do_leakcheck_vg,
        .needs = "tests_pass_valgrind"
 };