From 996af45a952a24701c84753b6b462556e91f1476 Mon Sep 17 00:00:00 2001 From: Florian Obser Date: Thu, 16 Jul 2015 18:37:00 +0000 Subject: add missing malloc check OK benno@ --- sys/net/if_pflow.c | 9 ++++++--- 1 file 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 @@ -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; -- cgit v1.2.3