From 83dfef72c076af993a379b674041e30dcc3fa52d Mon Sep 17 00:00:00 2001 From: Jason Wright Date: Mon, 27 Sep 2004 17:28:04 +0000 Subject: check malloc return correctly; from Patrick Latifi --- sys/arch/sparc64/dev/central.c | 4 ++-- sys/arch/sparc64/dev/fhc.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/arch') diff --git a/sys/arch/sparc64/dev/central.c b/sys/arch/sparc64/dev/central.c index ff0df84ad10..896d578b010 100644 --- a/sys/arch/sparc64/dev/central.c +++ b/sys/arch/sparc64/dev/central.c @@ -1,4 +1,4 @@ -/* $OpenBSD: central.c,v 1.3 2004/09/24 20:49:57 jason Exp $ */ +/* $OpenBSD: central.c,v 1.4 2004/09/27 17:28:03 jason Exp $ */ /* * Copyright (c) 2004 Jason L. Wright (jason@thought.net) @@ -121,7 +121,7 @@ central_get_string(int node, char *name, char **buf) if (len < 0) return (len); *buf = (char *)malloc(len + 1, M_DEVBUF, M_NOWAIT); - if (buf == NULL) + if (*buf == NULL) return (-1); if (len != 0) diff --git a/sys/arch/sparc64/dev/fhc.c b/sys/arch/sparc64/dev/fhc.c index 96e909e5e7f..b596d2f31c2 100644 --- a/sys/arch/sparc64/dev/fhc.c +++ b/sys/arch/sparc64/dev/fhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fhc.c,v 1.4 2004/09/24 21:29:36 jason Exp $ */ +/* $OpenBSD: fhc.c,v 1.5 2004/09/27 17:28:03 jason Exp $ */ /* * Copyright (c) 2004 Jason L. Wright (jason@thought.net) @@ -123,7 +123,7 @@ fhc_get_string(int node, char *name, char **buf) if (len < 0) return (len); *buf = (char *)malloc(len + 1, M_DEVBUF, M_NOWAIT); - if (buf == NULL) + if (*buf == NULL) return (-1); if (len != 0) -- cgit v1.2.3