summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/macppc/stand/alloc.c9
-rw-r--r--sys/arch/sparc64/stand/ofwboot/alloc.c9
-rw-r--r--sys/arch/zaurus/stand/zboot/alloc.c10
3 files changed, 21 insertions, 7 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);
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);
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);