summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-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
-rw-r--r--sys/lib/libsa/alloc.c10
4 files changed, 28 insertions, 10 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);
diff --git a/sys/lib/libsa/alloc.c b/sys/lib/libsa/alloc.c
index 64f8a0bc643..1714ec06600 100644
--- a/sys/lib/libsa/alloc.c
+++ b/sys/lib/libsa/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.10 2009/05/14 18:54:03 miod Exp $ */
+/* $OpenBSD: alloc.c,v 1.11 2015/09/14 17:34:04 semarie Exp $ */
/* $NetBSD: alloc.c,v 1.6 1997/02/04 18:36:33 thorpej Exp $ */
/*
@@ -213,8 +213,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);