Module: wine Branch: master Commit: a030777f741e12fbd90d7bb6af3bfc52d06685b2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a030777f741e12fbd90d7bb6af...
Author: Gerald Pfeifer gerald@pfeifer.com Date: Mon Dec 3 22:56:37 2007 +0100
msvcrt: Fix error handling in _aligned_offset_realloc().
---
dlls/msvcrt/heap.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c index 06c9d56..2f7fb9f 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 *));