summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2015-07-16 18:37:00 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2015-07-16 18:37:00 +0000
commit996af45a952a24701c84753b6b462556e91f1476 (patch)
treef0997cdf120f394af9e13cecea38c3d5358797ef
parentc6cb371fbc1b2375ef6fd924c2e5c143016e804c (diff)
add missing malloc check
OK benno@
-rw-r--r--sys/net/if_pflow.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c
index 322c5b2d47c..4f3ac5e82d4 100644
--- a/sys/net/if_pflow.c
+++ b/sys/net/if_pflow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflow.c,v 1.51 2015/06/16 11:09:39 mpi Exp $ */
+/* $OpenBSD: if_pflow.c,v 1.52 2015/07/16 18:36:59 florian Exp $ */
/*
* Copyright (c) 2011 Florian Obser <florian@narrans.de>
@@ -124,9 +124,12 @@ pflow_clone_create(struct if_clone *ifc, int unit)
M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
return (ENOMEM);
- pflowif->sc_imo.imo_membership = malloc(
+ if ((pflowif->sc_imo.imo_membership = malloc(
(sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_IPMOPTS,
- M_WAITOK|M_ZERO);
+ M_WAITOK|M_ZERO)) == NULL) {
+ free(pflowif, M_DEVBUF, 0);
+ return (ENOMEM);
+ }
pflowif->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS;
pflowif->sc_receiver_ip.s_addr = INADDR_ANY;
pflowif->sc_receiver_port = 0;