4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-30 02:50:25 +08:00

* cygheap.cc (_crealloc): Avoid memcpy when _cmalloc returns NULL.

This commit is contained in:
Christopher Faylor 2007-11-23 16:37:05 +00:00
parent 2194c4db86
commit 32cba6cb3a
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2007-11-23 Christopher Faylor <me+cygwin@cgf.cx>
* cygheap.cc (_crealloc): Avoid memcpy when _cmalloc returns NULL.
2007-11-08 Christopher Faylor <me+cygwin@cgf.cx>
* dllfixdbg: Eliminate extra objcopy step.

View File

@ -232,8 +232,11 @@ _crealloc (void *ptr, unsigned size)
if (size <= oldsize)
return ptr;
newptr = _cmalloc (size);
memcpy (newptr, ptr, oldsize);
_cfree (ptr);
if (newptr)
{
memcpy (newptr, ptr, oldsize);
_cfree (ptr);
}
}
return newptr;
}