From e0a66c157439fc5512e3406542a5a96667f2e452 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 29 Jan 2008 17:28:27 +0000 Subject: 2008-01-29 Joel Sherrill * libcsupport/Makefile.am, libcsupport/include/rtems/malloc.h, libcsupport/src/malloc_walk.c, libcsupport/src/posix_memalign.c, libcsupport/src/realloc.c, score/src/heapwalk.c: Add rtems_memalign as helper and as exposed nmemalign variant with few restrictions. Also turn on compilation of _Heap_Walk but make forced calls to it conditionally compiled. This should allow more flexibility to the user as to run-time checking of the heap. * libcsupport/src/rtems_memalign.c: New file. --- cpukit/libcsupport/src/realloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cpukit/libcsupport/src/realloc.c') diff --git a/cpukit/libcsupport/src/realloc.c b/cpukit/libcsupport/src/realloc.c index cba244cc37..745568c49d 100644 --- a/cpukit/libcsupport/src/realloc.c +++ b/cpukit/libcsupport/src/realloc.c @@ -54,6 +54,11 @@ void *realloc( return (void *) 0; } + if ( !_Protected_heap_Get_block_size(&RTEMS_Malloc_Heap, ptr, &old_size) ) { + errno = EINVAL; + return (void *) 0; + } + /* * If block boundary integrity checking is enabled, then * we need to account for the boundary memory again. @@ -89,11 +94,6 @@ void *realloc( return (void *) 0; } - if ( !_Protected_heap_Get_block_size(&RTEMS_Malloc_Heap, ptr, &old_size) ) { - errno = EINVAL; - return (void *) 0; - } - memcpy( new_area, ptr, (size < old_size) ? size : old_size ); free( ptr ); -- cgit v1.2.3