X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdlib%2Frealloc.c;h=90214e0ccc2ac877feed6e113c57f61a0d06a988;hb=3f6094115e79a45413f08361b68b71eb08da306e;hp=df5fca1bc75904411404315cac347ea32f8d164c;hpb=137bef7f4838fc430682213fa628e16b2237ed63;p=pdclib diff --git a/functions/stdlib/realloc.c b/functions/stdlib/realloc.c index df5fca1..90214e0 100644 --- a/functions/stdlib/realloc.c +++ b/functions/stdlib/realloc.c @@ -18,6 +18,11 @@ void * realloc( void * ptr, size_t size ) { + if ( ptr == NULL ) + { + return malloc( size ); + } + { struct _PDCLIB_memnode_t * baseptr = (struct _PDCLIB_memnode_t *)( (char *)ptr - sizeof( struct _PDCLIB_memnode_t ) ); if ( baseptr->size >= size ) { @@ -30,6 +35,7 @@ void * realloc( void * ptr, size_t size ) free( ptr ); return newptr; } + } return NULL; }