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/zaurus | |
parent | 1dfa13dfcd6cd2d0c0e63ef01d19c4fe9fc94ae2 (diff) |
unify free(NULL,size) behaviour by allowing passing NULL
ok millert@ jasper@
Diffstat (limited to 'sys/arch/zaurus')
-rw-r--r-- | sys/arch/zaurus/stand/zboot/alloc.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/arch/zaurus/stand/zboot/alloc.c b/sys/arch/zaurus/stand/zboot/alloc.c index bcb94800754..aa09eb2fa23 100644 --- a/sys/arch/zaurus/stand/zboot/alloc.c +++ b/sys/arch/zaurus/stand/zboot/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.1 2005/01/10 00:25:03 deraadt Exp $ */ +/* $OpenBSD: alloc.c,v 1.2 2015/09/14 17:34:04 semarie Exp $ */ /* $NetBSD: alloc.c,v 1.6 1997/02/04 18:36:33 thorpej Exp $ */ /* @@ -202,8 +202,12 @@ found: void free(void *ptr, unsigned int size) { - struct fl *f = (struct fl *)((char *)ptr - - ALIGN(sizeof(unsigned))); + struct fl *f; + + if (ptr == NULL) + return; + + f = (struct fl *)((char *)ptr - ALIGN(sizeof(unsigned))); #ifdef ALLOC_TRACE printf("free(%p, %u) (origsize %u)\n", ptr, size, f->size); |