summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/malloc.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-09-04 13:02:57 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-09-04 13:02:57 +0000
commitd9c3805a73aea84f5c054e4022ada63e28ce6b99 (patch)
tree8757185f5481f2c34ebd647c37e6b5206551d66e /cpukit/libcsupport/src/malloc.c
parent2003-09-04 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-d9c3805a73aea84f5c054e4022ada63e28ce6b99.tar.bz2
2003-09-04 Joel Sherrill <joel@OARcorp.com>
PR 479/rtems_misc * src/malloc.c: Per multiple standards realloc does not free the original memory if the allocation of the requested larger block fails.
Diffstat (limited to 'cpukit/libcsupport/src/malloc.c')
-rw-r--r--cpukit/libcsupport/src/malloc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cpukit/libcsupport/src/malloc.c b/cpukit/libcsupport/src/malloc.c
index e89408284d..b8139e8370 100644
--- a/cpukit/libcsupport/src/malloc.c
+++ b/cpukit/libcsupport/src/malloc.c
@@ -279,8 +279,13 @@ void *realloc(
MSBUMP(malloc_calls, -1); /* subtract off the malloc */
+ /*
+ * There used to be a free on this error case but it is wrong to
+ * free the memory per OpenGroup Single UNIX Specification V2
+ * and the C Standard.
+ */
+
if ( !new_area ) {
- free( ptr );
return (void *) 0;
}