diff options
author | Sebastien Marie <semarie@cvs.openbsd.org> | 2015-09-14 17:34:05 +0000 |
---|---|---|
committer | Sebastien Marie <semarie@cvs.openbsd.org> | 2015-09-14 17:34:05 +0000 |
commit | 6c0f51189e9d1b8a4bc7733cdd1cab12c307bed6 (patch) | |
tree | 830f28eadfc95d2de46f5188295a5e7c24386dee /sys/arch/macppc | |
parent | 1dfa13dfcd6cd2d0c0e63ef01d19c4fe9fc94ae2 (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.c | 9 |
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); |