From: José Fonseca Date: Thu, 19 Apr 2012 16:21:23 +0000 (+0100) Subject: Preserve non-NULL arrays, even when length is zero. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=016f0595bb08cb9ddb420f66f5b3dc582be1adcf;p=apitrace Preserve non-NULL arrays, even when length is zero. --- diff --git a/retrace/retrace.hpp b/retrace/retrace.hpp index c1e556a..4ee1a61 100644 --- a/retrace/retrace.hpp +++ b/retrace/retrace.hpp @@ -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(malloc(sizeof(uintptr_t) + size)); if (!buf) {