Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2007-11-23 19:37:05 +0300
committerChristopher Faylor <me@cgf.cx>2007-11-23 19:37:05 +0300
commit32cba6cb3a8366df854ba24ece2a60f1b2f872a3 (patch)
tree21b23f484ecfe4023485f548169cceb3efc52ad3 /winsup/cygwin/cygheap.cc
parent2194c4db86e473a25656c3bcc5315e9a05577981 (diff)
* cygheap.cc (_crealloc): Avoid memcpy when _cmalloc returns NULL.
Diffstat (limited to 'winsup/cygwin/cygheap.cc')
-rw-r--r--winsup/cygwin/cygheap.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 3b4b72ba7..c25434188 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -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;
}