summaryrefslogtreecommitdiff
path: root/sys/arch/macppc
diff options
context:
space:
mode:
authorSebastien Marie <semarie@cvs.openbsd.org>2015-09-14 17:34:05 +0000
committerSebastien Marie <semarie@cvs.openbsd.org>2015-09-14 17:34:05 +0000
commit6c0f51189e9d1b8a4bc7733cdd1cab12c307bed6 (patch)
tree830f28eadfc95d2de46f5188295a5e7c24386dee /sys/arch/macppc
parent1dfa13dfcd6cd2d0c0e63ef01d19c4fe9fc94ae2 (diff)
unify free(NULL,size) behaviour by allowing passing NULL
ok millert@ jasper@
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r--sys/arch/macppc/stand/alloc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/arch/macppc/stand/alloc.c b/sys/arch/macppc/stand/alloc.c
index 0acd41fde40..6d6f9595d25 100644
--- a/sys/arch/macppc/stand/alloc.c
+++ b/sys/arch/macppc/stand/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.8 2014/02/23 06:16:45 jsg Exp $ */
+/* $OpenBSD: alloc.c,v 1.9 2015/09/14 17:34:03 semarie Exp $ */
/* $NetBSD: alloc.c,v 1.1 1997/04/16 20:29:16 thorpej Exp $ */
/*
@@ -173,7 +173,12 @@ out:
void
free(void *ptr, unsigned size)
{
- register struct ml *a = (struct ml *)((char *)ptr - OVERHEAD);
+ register struct ml *a;
+
+ if (ptr == NULL)
+ return;
+
+ a = (struct ml *)((char *)ptr - OVERHEAD);
#ifdef ALLOC_TRACE
printf("free(%lx, %u) (origsize %u)\n", (u_long)ptr, size, a->size);