X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=test%2Flib%2Flist-test.c;h=144613da7d06a1da673091bba1c9ae27cebe649b;hp=c532282aadbd5c3d886c9a0838761c1b35bea13b;hb=ffb84fc1bf1d138d1ac1bb8ece0b7d625f288d97;hpb=5399335e509f1866d071f03f6163b86ae608d9c5 diff --git a/test/lib/list-test.c b/test/lib/list-test.c index c532282..144613d 100644 --- a/test/lib/list-test.c +++ b/test/lib/list-test.c @@ -19,12 +19,11 @@ #include "config.h" #endif -#define _GNU_SOURCE - #include #include #include +#include int main(void) @@ -36,10 +35,13 @@ int main(void) STATIC_LIST(tester); struct item *item; struct item *tmp; + void *ctx; int i; + ctx = talloc_new(NULL); + for (i = 0; i < 5; i++) { - struct item *item = malloc(sizeof(struct item)); + struct item *item = talloc(ctx, struct item); item->value = i; @@ -83,5 +85,8 @@ int main(void) return EXIT_FAILURE; } fprintf(stderr, "-- done --\n"); + + talloc_free(ctx); + return EXIT_SUCCESS; }