(realloc): Handle NULL for first parameter correctly.
[platform/upstream/glibc.git] / elf / dl-minimal.c
index 564da7d..b72faa0 100644 (file)
@@ -111,6 +111,8 @@ void * weak_function
 realloc (void *ptr, size_t n)
 {
   void *new;
+  if (ptr == NULL)
+    return malloc (n);
   assert (ptr == alloc_last_block);
   alloc_ptr = alloc_last_block;
   new = malloc (n);