From 41570a5ed979f8e277b124caa7023abcb726b5f3 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 19 Apr 2012 12:07:20 -0400 Subject: tests: Make sure unused malloc() doesn't get optimized away --- tests/sanity-test.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/sanity-test.c b/tests/sanity-test.c index 77b5cee..90e55ff 100644 --- a/tests/sanity-test.c +++ b/tests/sanity-test.c @@ -36,6 +36,8 @@ FAIL_TEST(sanity_malloc_direct) void *p; p = malloc(10); /* memory leak */ + assert(p); /* assert that we got memory, also prevents + * the malloc from getting optimized away. */ free(NULL); /* NULL must not be counted */ } -- cgit v1.2.3