summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-10-29 20:35:39 +0000
committerphk <phk@FreeBSD.org>1996-10-29 20:35:39 +0000
commit10c5f03c811e92644cd7670d2470fc8782a3fd1e (patch)
treef20e116027e6436b8e62f88e72c54a8c95fe87f8 /lib
parent7736b90b960da62df7f035463289a3ed6eda2d4c (diff)
downloadFreeBSD-src-10c5f03c811e92644cd7670d2470fc8782a3fd1e.zip
FreeBSD-src-10c5f03c811e92644cd7670d2470fc8782a3fd1e.tar.gz
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 <archie@whistle.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/malloc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index 3dc838e..b1cdb25 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;
OpenPOWER on IntegriCloud