+2017-08-31 Florian Weimer <fweimer@redhat.com>
+
+ * malloc/malloc.c (top_check): Change return type to void. Remove
+ internal_function.
+ * malloc/hooks.c (top_check): Likewise.
+ (malloc_check, realloc_check, memalign_check): Adjust.
+
2017-08-30 Joseph Myers <joseph@codesourcery.com>
[BZ #21457]
}
/* Check for corruption of the top chunk. */
-static int
-internal_function
+static void
top_check (void)
{
mchunkptr t = top (&main_arena);
prev_inuse (t) &&
(!contiguous (&main_arena) ||
(char *) t + chunksize (t) == mp_.sbrk_base + main_arena.system_mem)))
- return 0;
+ return;
malloc_printerr ("malloc: top chunk is corrupt");
}
}
__libc_lock_lock (main_arena.mutex);
- victim = (top_check () >= 0) ? _int_malloc (&main_arena, sz + 1) : NULL;
+ top_check ();
+ victim = _int_malloc (&main_arena, sz + 1);
__libc_lock_unlock (main_arena.mutex);
return mem2mem_check (victim, sz);
}
else
{
/* Must alloc, copy, free. */
- if (top_check () >= 0)
- newmem = _int_malloc (&main_arena, bytes + 1);
+ top_check ();
+ newmem = _int_malloc (&main_arena, bytes + 1);
if (newmem)
{
memcpy (newmem, oldmem, oldsize - 2 * SIZE_SZ);
}
else
{
- if (top_check () >= 0)
- {
- INTERNAL_SIZE_T nb;
- checked_request2size (bytes + 1, nb);
- newmem = _int_realloc (&main_arena, oldp, oldsize, nb);
- }
+ top_check ();
+ INTERNAL_SIZE_T nb;
+ checked_request2size (bytes + 1, nb);
+ newmem = _int_realloc (&main_arena, oldp, oldsize, nb);
}
/* mem2chunk_check changed the magic byte in the old chunk.
}
__libc_lock_lock (main_arena.mutex);
- mem = (top_check () >= 0) ? _int_memalign (&main_arena, alignment, bytes + 1) :
- NULL;
+ top_check ();
+ mem = _int_memalign (&main_arena, alignment, bytes + 1);
__libc_lock_unlock (main_arena.mutex);
return mem2mem_check (mem, bytes);
}
static void malloc_printerr(const char *str) __attribute__ ((noreturn));
static void* internal_function mem2mem_check(void *p, size_t sz);
-static int internal_function top_check(void);
+static void top_check (void);
static void internal_function munmap_chunk(mchunkptr p);
#if HAVE_MREMAP
static mchunkptr internal_function mremap_chunk(mchunkptr p, size_t new_size);