summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-04-19 12:07:20 -0400
committerKristian Høgsberg <krh@bitplanet.net>2012-04-19 12:07:20 -0400
commit41570a5ed979f8e277b124caa7023abcb726b5f3 (patch)
tree16df7f7eb87ccdac542cbbec97724307c7dd58fb /tests
parent55489883c4f47e2716270be0085be6b7c99d3b18 (diff)
tests: Make sure unused malloc() doesn't get optimized away
Diffstat (limited to 'tests')
-rw-r--r--tests/sanity-test.c2
1 files changed, 2 insertions, 0 deletions
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 */
}