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:
authorCorinna Vinschen <corinna@vinschen.de>2007-11-26 13:01:26 +0300
committerCorinna Vinschen <corinna@vinschen.de>2007-11-26 13:01:26 +0300
commit993ba7b4880b80af97846040487ece6b65f4b791 (patch)
tree813b962b514d2a719a520e9f5c8d8f91bf4e458c
parente2cee41622b8c9b4e10f0166d32c430163113f9d (diff)
* cygheap.cc (_crealloc): Avoid memcpy when _cmalloc returns NULL.
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/cygheap.cc7
2 files changed, 9 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index c32d53a25..338b5947d 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2007-11-23 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * cygheap.cc (_crealloc): Avoid memcpy when _cmalloc returns NULL.
+
2007-11-22 Christian Franke <franke@computer.org>
* fhandler_registry.cc (must_encode): New function.
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index caeda7b3a..250f7d496 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;
}