]> git.marmaro.de Git - mmh/blobdiff - sbr/utils.c
Add protective 'do { ... } while (0)' wrappers to multistatement macros
[mmh] / sbr / utils.c
index d822995ba251ed46c8d8a14ffa332f23840d4970..7c4ddcf26e46fe4256c0d39e1835958b4ffa27d9 100644 (file)
@@ -47,6 +47,10 @@ mh_xrealloc(void *ptr, size_t size)
 {
     void *memory;
 
+    /* Some non-POSIX realloc()s don't cope with realloc(NULL,sz) */
+    if (!ptr)
+        return mh_xmalloc(size);
+
     if (size == 0)
         adios(NULL, "Tried to realloc 0bytes");