summaryrefslogtreecommitdiff
path: root/sys/net/pf_if.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2022-05-16 13:31:20 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2022-05-16 13:31:20 +0000
commit553eeed8361e3c3bdec459d015379e01a44e8908 (patch)
tree404f94e060b9c59ac5e8f1684a2495372aec845a /sys/net/pf_if.c
parentf00b6e7f07517eb892c21d5e1af8e7d5a3f40c74 (diff)
pfi_kif_alloc() may be called with M_NOWAIT. Add NULL check to
handle malloc(9) failure. from markus@; OK sashan@
Diffstat (limited to 'sys/net/pf_if.c')
-rw-r--r--sys/net/pf_if.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/pf_if.c b/sys/net/pf_if.c
index e5dd4ad963b..dd1b11d44af 100644
--- a/sys/net/pf_if.c
+++ b/sys/net/pf_if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_if.c,v 1.104 2022/04/29 09:55:43 mbuhl Exp $ */
+/* $OpenBSD: pf_if.c,v 1.105 2022/05/16 13:31:19 bluhm Exp $ */
/*
* Copyright 2005 Henning Brauer <henning@openbsd.org>
@@ -93,6 +93,8 @@ pfi_kif_alloc(const char *kif_name, int mflags)
struct pfi_kif *kif;
kif = malloc(sizeof(*pfi_all), PFI_MTYPE, mflags|M_ZERO);
+ if (kif == NULL)
+ return (NULL);
strlcpy(kif->pfik_name, kif_name, sizeof(kif->pfik_name));
kif->pfik_tzero = gettime();
TAILQ_INIT(&kif->pfik_dynaddrs);