summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2013-07-04 17:35:53 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2013-07-04 17:35:53 +0000
commit8a6713047bfb9a490715c69aac3515eb989f7dcd (patch)
treea297b117b23136483e4e30504eef1c2fac36fa51 /sys
parent636045de9ff94f9f06e9eb8dda0a78bf4dd24875 (diff)
permit free(NULL) to work. ok deraadt
Diffstat (limited to 'sys')
-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;