Przeglądaj źródła

malloc: sbrk() should return MORECORE_FAILURE instead of NULL on failure

Signed-off-by: Karl Beldan <karl.beldan@gmail.com>
karl.beldan@gmail.com 15 lat temu
rodzic
commit
ae30b8c200
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      common/dlmalloc.c

+ 1 - 1
common/dlmalloc.c

@@ -1515,7 +1515,7 @@ void *sbrk(ptrdiff_t increment)
 	ulong new = old + increment;
 	ulong new = old + increment;
 
 
 	if ((new < mem_malloc_start) || (new > mem_malloc_end))
 	if ((new < mem_malloc_start) || (new > mem_malloc_end))
-		return NULL;
+		return (void *)MORECORE_FAILURE;
 
 
 	mem_malloc_brk = new;
 	mem_malloc_brk = new;