* tests/test_malloc.c (free_list): New function definition.
* tests/test_malloc.c (run_one_test): Call free_list(x) on return.
return cons(m, make_list(m+1, n));
}
+void free_list(ln *x)
+{
+ while (x != NULL) {
+ ln *next = x -> next;
+ AO_free(x);
+ x = next;
+ }
+}
+
/* Reverse list x, and concatenate it to y, deallocating no longer needed */
/* nodes in x. */
ln *
x = reverse(x, 0);
}
check_list(x, 1, LIST_LENGTH);
+ free_list(x);
return arg; /* use arg to suppress compiler warning */
}