From f3f639a106a17c4271746a977001029abc45a90b Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Tue, 29 Oct 1996 20:35:39 +0000 Subject: If you run with option Z and malloc fails, memset gets called with a NULL pointer (archie) Explain that minsize is also the smallest alignment. Submitted by: Archie Cobbs --- lib/libc/stdlib/malloc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/libc/stdlib/malloc.c') diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 3dc838ec2afe..b1cdb2532888 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: malloc.c,v 1.16 1996/10/20 13:20:57 phk Exp $ + * $Id: malloc.c,v 1.17 1996/10/26 08:19:07 phk Exp $ * */ @@ -43,9 +43,11 @@ * It's probably best if this is the native * page size, but it shouldn't have to be. * - * malloc_minsize minimum size of an allocation + * malloc_minsize minimum size of an allocation in bytes. * If this is too small it's too much work - * to manage them. + * to manage them. This is also the smallest + * unit of alignment used for the storage + * returned by malloc/realloc. * */ @@ -737,7 +739,7 @@ imalloc(size_t size) if (malloc_abort && !result) wrterror("allocation failed.\n"); - if (malloc_zero) + if (malloc_zero && result) memset(result, 0, size); return result; -- cgit v1.2.3