X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdlib%2Frealloc.c;h=90214e0ccc2ac877feed6e113c57f61a0d06a988;hb=8165a19ca75f1405d8b8255252aa6330d202679e;hp=df5fca1bc75904411404315cac347ea32f8d164c;hpb=3213ac4b86f621b7335aea079c3217b3d8bc6f7c;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; }