#479 closed defect (fixed)
realloc deallocates argument pointer if new_area cannot be obtained
Reported by: | kamen | Owned by: | Joel Sherrill |
---|---|---|---|
Priority: | normal | Milestone: | 2 |
Component: | unspecified | Version: | 4.5 |
Severity: | major | Keywords: | |
Cc: | bugs@… | Blocked By: | |
Blocking: |
Description
Accordingly to "C Reference Manual", p. 388, documentation of realloc:
"If the request cannot be satisfied, a null pointer is returned and the old region is not disturbed."
However, the RTEMS definition of realloc contains this:
new_area = malloc( size );
MSBUMP(malloc_calls, -1); /* subtract off the malloc */
if ( !new_area ) {
free( ptr );
return (void *) 0;
}
free( ptr ) is erroneous and should be removed.
Release:
RTEMS-4.5 ss20030417
Environment:
host = Cygwin
target = powerpc
How-To-Repeat:
Allocate an array and keep growing it with realloc until realloc fails.
Attachments (1)
Change History (3)
comment:1 Changed on 09/04/03 at 11:43:15 by Joel Sherrill
Status: | assigned → closed |
---|
comment:2 Changed on 10/10/17 at 06:35:44 by Sebastian Huber
Component: | misc → unspecified |
---|
Note: See
TracTickets for help on using
tickets.
State-Changed-From-To: open->closed
State-Changed-Why: Fix in 4.6 branch and trunk. The Open Group Single UNIX