From 016f0595bb08cb9ddb420f66f5b3dc582be1adcf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 19 Apr 2012 17:21:23 +0100 Subject: [PATCH] Preserve non-NULL arrays, even when length is zero. --- retrace/retrace.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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) { -- 2.7.4