diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2016-01-26 15:44:29 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2016-01-26 15:44:29 +0000 |
commit | a1fe0bde5148e62c9929743ca593346a2c90f1e2 (patch) | |
tree | ff3c5c43b735eb20b15ac42c55ac00778ea56a20 /lib/libc | |
parent | 7f6be3534ee0eb24195e4350ebdf4e352876cfa9 (diff) |
Don't crash dumping malloc stats if malloc_init hasn't been called, noted by
David CARLIER
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdlib/malloc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 23e076bdafe..e8e55c079eb 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.180 2016/01/06 17:57:22 tedu Exp $ */ +/* $OpenBSD: malloc.c,v 1.181 2016/01/26 15:44:28 otto Exp $ */ /* * Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net> * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> @@ -1910,6 +1910,8 @@ malloc_dump(int fd) struct region_info *r; int saved_errno = errno; + if (pool == NULL) + return; for (i = 0; i < MALLOC_DELAYED_CHUNK_MASK + 1; i++) { p = pool->delayed_chunks[i]; if (p == NULL) |