Commit a209c6d5 authored by Rusty Russell's avatar Rusty Russell

grab_file: close memory leak in test.

parent 9e002ad0
...@@ -18,7 +18,7 @@ main(int argc, char *argv[]) ...@@ -18,7 +18,7 @@ main(int argc, char *argv[])
struct stat st; struct stat st;
str = grab_file(NULL, "test/run-grab.c", NULL); str = grab_file(NULL, "test/run-grab.c", NULL);
split = strsplit(NULL, str, "\n"); split = strsplit(str, str, "\n");
length = strlen(split[0]); length = strlen(split[0]);
ok1(!strcmp(split[0], "/* This is test for grab_file() function")); ok1(!strcmp(split[0], "/* This is test for grab_file() function"));
for (i = 1; split[i]; i++) for (i = 1; split[i]; i++)
...@@ -29,6 +29,7 @@ main(int argc, char *argv[]) ...@@ -29,6 +29,7 @@ main(int argc, char *argv[])
if (stat("ccan/grab_file/test/run-grab.c", &st) != 0) if (stat("ccan/grab_file/test/run-grab.c", &st) != 0)
err(1, "Could not stat self"); err(1, "Could not stat self");
ok1(st.st_size == length + i); ok1(st.st_size == length + i);
talloc_free(str);
return 0; return 0;
} }
......
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