]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Runs now on Darwin too.
authorBart Van Assche <bvanassche@acm.org>
Tue, 21 Jul 2009 11:19:54 +0000 (11:19 +0000)
committerBart Van Assche <bvanassche@acm.org>
Tue, 21 Jul 2009 11:19:54 +0000 (11:19 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10500

drd/tests/memory_allocation.c

index 4af3c4e767acaebf943abf1e5cdba5d66b60beea..1072489d0cb31d1849e558452c4a318fba8c74d9 100644 (file)
@@ -21,7 +21,17 @@ int main()
     p = realloc(p, 50000);
     p = realloc(p, 40000);
     p = realloc(p, 0);
+    /*
+     * glibc returns a NULL pointer when the size argument passed to realloc()
+     * is zero, while Darwin's C library returns a non-NULL pointer. Both are
+     * allowed by POSIX.
+     */
+#if defined(__APPLE__)
+    if (p)
+      free(p);
+#else
     assert(! p);
+#endif
   }
 
   return 0;