From b30d92dfb22a9200e69fc4c5193b63d587464c7e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 18 Mar 2005 14:09:55 +0000 Subject: [PATCH] Fixed other instances of the xrealloc(0) bug. --- programs/winetest/util.c | 2 +- tools/winegcc/utils.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/programs/winetest/util.c b/programs/winetest/util.c index d09b90bcc51..0365d539f00 100644 --- a/programs/winetest/util.c +++ b/programs/winetest/util.c @@ -36,7 +36,7 @@ void *xrealloc (void *op, size_t len) { void *p = realloc (op, len); - if (!p) report (R_FATAL, "Out of memory."); + if (len && !p) report (R_FATAL, "Out of memory."); return p; } diff --git a/tools/winegcc/utils.c b/tools/winegcc/utils.c index ee404d58411..6d5d31ef77b 100644 --- a/tools/winegcc/utils.c +++ b/tools/winegcc/utils.c @@ -60,8 +60,8 @@ void* xmalloc(size_t size) void *xrealloc(void* p, size_t size) { - void* p2; - if ((p2 = realloc (p, size)) == NULL) + void* p2 = realloc (p, size); + if (size && !p2) error("Can not realloc %d bytes.", size); return p2;