From ac376f3391e54a39ad3727967e920e2dcd1703ae Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Sat, 23 Jun 2001 05:45:14 +0000 Subject: Since malloc in hashinit can get M_NOWAIT flags, we should check the return value. --- sys/kern/kern_subr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sys') diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index 59550ac7940..4fd1742f18f 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_subr.c,v 1.16 2000/09/07 19:21:30 art Exp $ */ +/* $OpenBSD: kern_subr.c,v 1.17 2001/06/23 05:45:13 art Exp $ */ /* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */ /* @@ -182,6 +182,8 @@ hashinit(elements, type, flags, hashmask) continue; hashsize >>= 1; hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, flags); + if (hashtbl == NULL) + return NULL; for (i = 0; i < hashsize; i++) LIST_INIT(&hashtbl[i]); *hashmask = hashsize - 1; -- cgit v1.2.3