From a030777f741e12fbd90d7bb6af3bfc52d06685b2 Mon Sep 17 00:00:00 2001 From: Gerald Pfeifer Date: Mon, 3 Dec 2007 22:56:37 +0100 Subject: [PATCH] msvcrt: Fix error handling in _aligned_offset_realloc(). --- dlls/msvcrt/heap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c index 06c9d56205b..2f7fb9f3dde 100644 --- a/dlls/msvcrt/heap.c +++ b/dlls/msvcrt/heap.c @@ -443,13 +443,14 @@ void * CDECL _aligned_offset_realloc(void *memblock, MSVCRT_size_t size, /* It seems this function was called with an invalid pointer. Bail out. */ return NULL; } + /* Adjust old_size to get amount of actual data in old block. */ - old_size -= old_padding; - if (old_size < 0) + if (old_size < old_padding) { /* Shouldn't happen. Something's weird, so bail out. */ return NULL; } + old_size -= old_padding; temp = MSVCRT_realloc(*saved, size + alignment + sizeof(void *)); -- 2.11.4.GIT