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 ")) {
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);
}
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"
};