X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftalloc%2Ftest%2Frun-set_allocator.c;h=e1c76d4c045995956b9e1b68961a77dd6da49aa5;hb=8301696801143ef07b2ede7da6d614e8d9992a1e;hp=e485c62337c64a6487e5018f03a5bc0f4025659d;hpb=8f8b0216dab8e9a91f3696a8a8f3a4ebd8779c7c;p=ccan diff --git a/ccan/talloc/test/run-set_allocator.c b/ccan/talloc/test/run-set_allocator.c index e485c623..e1c76d4c 100644 --- a/ccan/talloc/test/run-set_allocator.c +++ b/ccan/talloc/test/run-set_allocator.c @@ -34,16 +34,27 @@ int main(int argc, char *argv[]) failtest_init(argc, argv); talloc_set_allocator(my_malloc, my_free, my_realloc); p1 = talloc_array(NULL, int, 10); + if (!p1) + failtest_exit(exit_status()); ok1(my_malloc_count == 1); ok1(my_free_count == 0); ok1(my_realloc_count == 0); - p1 = talloc_realloc(NULL, p1, int, 10000); + p2 = talloc_realloc(NULL, p1, int, 10000); + if (!p2) { + talloc_free(p1); + failtest_exit(exit_status()); + } + p1 = p2; ok1(my_malloc_count == 1); ok1(my_free_count == 0); ok1(my_realloc_count == 1); p2 = talloc(p1, int); + if (!p2) { + talloc_free(p1); + failtest_exit(exit_status()); + } ok1(my_malloc_count == 2); ok1(my_free_count == 0); ok1(my_realloc_count == 1);