From 6c0f51189e9d1b8a4bc7733cdd1cab12c307bed6 Mon Sep 17 00:00:00 2001 From: Sebastien Marie Date: Mon, 14 Sep 2015 17:34:05 +0000 Subject: unify free(NULL,size) behaviour by allowing passing NULL ok millert@ jasper@ --- sys/arch/macppc/stand/alloc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sys/arch/macppc') 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); -- cgit v1.2.3