Rather than returning NULL from malloc_create_zone and malloc_default_zone, return (void *)-1 on platforms without malloc zone support. Assertions under DISPATCH_DEBUG appear to require a non-NULL result, so provide one but not a pointer that can be used for anything (since that would be a bug). This is slightly different from the submitted patch, which returned a small ammount of malloc'd memory, in that I want to cause a segfault if the returned pointer is ever dereferenced, since that would imply a consumer that knows more about the internals than we implement in our stubs. Submitted by: Martin Nowack <martin.nowack at inf.tu-dresden.de>
--- trunk/src/shims/malloc_zone.h 2009-12-24 18:48:47 UTC (rev 175)
+++ trunk/src/shims/malloc_zone.h 2009-12-28 11:28:23 UTC (rev 176)
@@ -36,7 +36,7 @@
malloc_create_zone(size_t start_size, unsigned flags)
{
- return (NULL);
+ return ((void *)(-1));
}
static inline void
@@ -49,14 +49,14 @@
malloc_default_zone(void)
{
- return (NULL);
+ return ((void *)(-1));
}
static inline malloc_zone_t *
malloc_zone_from_ptr(const void *ptr)
{
- return (NULL);
+ return ((void *)(-1));
}
static inline void *