forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2003-09-02 Joel Sherrill <joel@OARcorp.com>
|
2003-09-02 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
* src/open.c: Fix typo.
|
* src/open.c: Fix typo.
|
||||||
|
|||||||
@@ -279,8 +279,13 @@ void *realloc(
|
|||||||
|
|
||||||
MSBUMP(malloc_calls, -1); /* subtract off the malloc */
|
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 ) {
|
if ( !new_area ) {
|
||||||
free( ptr );
|
|
||||||
return (void *) 0;
|
return (void *) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user