summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/malloc.c
diff options
context:
space:
mode:
authoritojun <itojun@NetBSD.org>2003-07-23 08:15:02 +0000
committeritojun <itojun@NetBSD.org>2003-07-23 08:15:02 +0000
commit6f4e912af4cee4bc78ff0ea62bd59f5549b80e31 (patch)
treee26d50998659f1545b73bd3cb38f32c6f07b8060 /lib/libc/stdlib/malloc.c
parente63468d8cc1c252caadaca025d4e9da297de3b80 (diff)
call malloc_init() on first call to free/realloc, to make malloc.conf to
take effect. in response to PR 22223
Diffstat (limited to 'lib/libc/stdlib/malloc.c')
-rw-r--r--lib/libc/stdlib/malloc.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index e5e70e2f8a3..d7589d3b1d0 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: malloc.c,v 1.41 2003/01/18 11:32:03 thorpej Exp $ */
+/* $NetBSD: malloc.c,v 1.42 2003/07/23 08:15:02 itojun Exp $ */
/*
* ----------------------------------------------------------------------------
@@ -1075,11 +1075,6 @@ ifree(void *ptr)
if (!ptr)
return;
- if (!malloc_started) {
- wrtwarning("malloc() has never been called.\n");
- return;
- }
-
/* If we're already sinking, don't make matters any worse. */
if (suicide)
return;
@@ -1150,10 +1145,11 @@ free(void *ptr)
malloc_active--;
THREAD_UNLOCK();
return;
- } else {
- ifree(ptr);
- UTRACE(ptr, 0, 0);
}
+ if (!malloc_started)
+ malloc_init();
+ ifree(ptr);
+ UTRACE(ptr, 0, 0);
malloc_active--;
THREAD_UNLOCK();
return;
@@ -1172,10 +1168,6 @@ realloc(void *ptr, size_t size)
THREAD_UNLOCK();
return (0);
}
- if (ptr && !malloc_started) {
- wrtwarning("malloc() has never been called.\n");
- ptr = 0;
- }
if (!malloc_started)
malloc_init();
if (malloc_sysv && !size) {