]> git.notmuchmail.org Git - apitrace/commitdiff
Preserve non-NULL arrays, even when length is zero.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 19 Apr 2012 16:21:23 +0000 (17:21 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 19 Apr 2012 16:21:23 +0000 (17:21 +0100)
retrace/retrace.hpp

index c1e556a97fbb03d726be09de3cb92540de88e5fc..4ee1a61afc401ca8547bb77e034893906c62e5ed 100644 (file)
@@ -101,9 +101,8 @@ public:
 
     inline void *
     alloc(size_t size) {
-        if (!size) {
-            return NULL;
-        }
+        /* Always return valid address, even when size is zero */
+        size = std::max(size, sizeof(uintptr_t));
 
         uintptr_t * buf = static_cast<uintptr_t *>(malloc(sizeof(uintptr_t) + size));
         if (!buf) {