diff options
Diffstat (limited to 'cpukit/libcsupport/src/malloc.c')
-rw-r--r-- | cpukit/libcsupport/src/malloc.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/cpukit/libcsupport/src/malloc.c b/cpukit/libcsupport/src/malloc.c index 64d3a715e7..91acf92c44 100644 --- a/cpukit/libcsupport/src/malloc.c +++ b/cpukit/libcsupport/src/malloc.c @@ -308,7 +308,7 @@ void *realloc( } /* - * Continue with calloc(). + * Continue with realloc(). */ if ( !ptr ) return malloc( size ); @@ -318,6 +318,17 @@ void *realloc( return (void *) 0; } + status = + rtems_region_resize_segment( RTEMS_Malloc_Heap, ptr, size, &old_size ); + + if( status == RTEMS_SUCCESSFUL ) { + return ptr; + } + else if ( status != RTEMS_UNSATISFIED ) { + errno = EINVAL; + return (void *) 0; + } + new_area = malloc( size ); MSBUMP(malloc_calls, -1); /* subtract off the malloc */ |