Browse Source

Don't crash dumping malloc stats if malloc_init hasn't been called, noted by

David CARLIER
OPENBSD_5_9
otto 8 years ago
parent
commit
0af523ebbd
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      src/lib/libc/stdlib/malloc.c

+ 3
- 1
src/lib/libc/stdlib/malloc.c View File

@ -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) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net>
* Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@ -1910,6 +1910,8 @@ malloc_dump(int fd)
struct region_info *r; struct region_info *r;
int saved_errno = errno; int saved_errno = errno;
if (pool == NULL)
return;
for (i = 0; i < MALLOC_DELAYED_CHUNK_MASK + 1; i++) { for (i = 0; i < MALLOC_DELAYED_CHUNK_MASK + 1; i++) {
p = pool->delayed_chunks[i]; p = pool->delayed_chunks[i];
if (p == NULL) if (p == NULL)


Loading…
Cancel
Save