summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc_debug.c
diff options
context:
space:
mode:
authorart <art@openbsd.org>2002-12-20 06:00:53 +0000
committerart <art@openbsd.org>2002-12-20 06:00:53 +0000
commit925e59ac150aeb0f9142eb58d73baef0a85415ea (patch)
tree4b711f6995b9e0062d0669a9a9db67b1c2eb788d /sys/kern/kern_malloc_debug.c
parentuser-defined stacks check is the same for grownups as for growndowns (diff)
downloadwireguard-openbsd-925e59ac150aeb0f9142eb58d73baef0a85415ea.tar.xz
wireguard-openbsd-925e59ac150aeb0f9142eb58d73baef0a85415ea.zip
Add a special malloc type M_DEBUG.
If the kernel is compiled with MALLOC_DEBUG, M_DEBUG will force the allocation to be done through malloc_debug.
Diffstat (limited to 'sys/kern/kern_malloc_debug.c')
-rw-r--r--sys/kern/kern_malloc_debug.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/kern_malloc_debug.c b/sys/kern/kern_malloc_debug.c
index c31aa4adc96..beffe411edf 100644
--- a/sys/kern/kern_malloc_debug.c
+++ b/sys/kern/kern_malloc_debug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_malloc_debug.c,v 1.20 2002/12/05 22:32:04 art Exp $ */
+/* $OpenBSD: kern_malloc_debug.c,v 1.21 2002/12/20 06:00:53 art Exp $ */
/*
* Copyright (c) 1999, 2000 Artur Grabowski <art@openbsd.org>
@@ -115,11 +115,11 @@ debug_malloc(unsigned long size, int type, int flags, void **addr)
int s, wait = flags & M_NOWAIT;
/* Careful not to compare unsigned long to int -1 */
- if ((type != debug_malloc_type && debug_malloc_type != 0) ||
+ if (((type != debug_malloc_type && debug_malloc_type != 0) ||
(size != debug_malloc_size && debug_malloc_size != 0) ||
(debug_malloc_size_lo != -1 && size < debug_malloc_size_lo) ||
(debug_malloc_size_hi != -1 && size > debug_malloc_size_hi) ||
- !debug_malloc_initialized)
+ !debug_malloc_initialized) && type != M_DEBUG)
return (0);
/* XXX - fix later */
@@ -163,7 +163,8 @@ debug_free(void *addr, int type)
vaddr_t va;
int s;
- if (type != debug_malloc_type && debug_malloc_type != 0)
+ if (type != debug_malloc_type && debug_malloc_type != 0 &&
+ type != M_DEBUG)
return (0);
/*