From: Bart Van Assche Date: Tue, 21 Jul 2009 11:19:54 +0000 (+0000) Subject: Runs now on Darwin too. X-Git-Tag: svn/VALGRIND_3_5_0~348 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1a4e519dcc8d7ed3c7d38016e90d7f4c68938099;p=thirdparty%2Fvalgrind.git Runs now on Darwin too. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10500 --- diff --git a/drd/tests/memory_allocation.c b/drd/tests/memory_allocation.c index 4af3c4e767..1072489d0c 100644 --- a/drd/tests/memory_allocation.c +++ b/drd/tests/memory_allocation.c @@ -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;