summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2013-07-04 17:35:52 +0000
committertedu <tedu@openbsd.org>2013-07-04 17:35:52 +0000
commit1d63b23b9da432d716f803e47d0260bb7add1ffc (patch)
tree9303cb51613c5a0480fe156bb9f8f27413e46a04 /sys/kern/kern_malloc.c
parentFormat string fixes: (diff)
downloadwireguard-openbsd-1d63b23b9da432d716f803e47d0260bb7add1ffc.tar.xz
wireguard-openbsd-1d63b23b9da432d716f803e47d0260bb7add1ffc.zip
permit free(NULL) to work. ok deraadt
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r--sys/kern/kern_malloc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 74a4aab6b9f..34a976613a3 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_malloc.c,v 1.101 2013/05/31 20:44:10 tedu Exp $ */
+/* $OpenBSD: kern_malloc.c,v 1.102 2013/07/04 17:35:52 tedu Exp $ */
/* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */
/*
@@ -376,6 +376,9 @@ free(void *addr, int type)
struct kmemstats *ksp = &kmemstats[type];
#endif
+ if (addr == NULL)
+ return;
+
#ifdef MALLOC_DEBUG
if (debug_free(addr, type))
return;