|
From: <sv...@va...> - 2009-07-21 11:19:57
|
Author: bart
Date: 2009-07-21 12:19:54 +0100 (Tue, 21 Jul 2009)
New Revision: 10500
Log:
Runs now on Darwin too.
Modified:
trunk/drd/tests/memory_allocation.c
Modified: trunk/drd/tests/memory_allocation.c
===================================================================
--- trunk/drd/tests/memory_allocation.c 2009-07-21 11:13:32 UTC (rev 10499)
+++ trunk/drd/tests/memory_allocation.c 2009-07-21 11:19:54 UTC (rev 10500)
@@ -21,7 +21,17 @@
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;
|