str: clean up tests so ccanlint doesn't complain about memory leaking.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 6 Jan 2011 03:50:26 +0000 (14:20 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 6 Jan 2011 03:50:26 +0000 (14:20 +1030)
ccan/str/test/run.c

index a9dacab051e9f28e7601df2778842529ba35e3fa..4648692be655165413d5cc250844df35f4553ccb 100644 (file)
@@ -73,9 +73,14 @@ int main(int argc, char *argv[])
                                ok1(!strstarts(strings[i], strings[j]));
                                ok1(!strends(reva, revb));
                        }
+                       free(reva);
+                       free(revb);
                }
        }
 
+       for (i = 0; i < n; i++)
+               free(strings[i]);
+
        ok1(streq(stringify(NUM_SUBSTRINGS),
                  "((sizeof(substrings) / sizeof(substrings[0])) - 1)"));
        ok1(streq(stringify(ARRAY_SIZE(substrings)),