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/sparc64 | |
parent | 1dfa13dfcd6cd2d0c0e63ef01d19c4fe9fc94ae2 (diff) |
unify free(NULL,size) behaviour by allowing passing NULL
ok millert@ jasper@
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/alloc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/arch/sparc64/stand/ofwboot/alloc.c b/sys/arch/sparc64/stand/ofwboot/alloc.c index 99ab1d7cb4b..577406544e7 100644 --- a/sys/arch/sparc64/stand/ofwboot/alloc.c +++ b/sys/arch/sparc64/stand/ofwboot/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.7 2014/12/11 10:52:07 stsp Exp $ */ +/* $OpenBSD: alloc.c,v 1.8 2015/09/14 17:34:03 semarie Exp $ */ /* $NetBSD: alloc.c,v 1.1 2000/08/20 14:58:37 mrg Exp $ */ /* @@ -173,7 +173,12 @@ alloc(unsigned size) 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); |