-/* $OpenBSD: ikev2.c,v 1.298 2021/01/23 21:35:48 tobhe Exp $ */
+/* $OpenBSD: ikev2.c,v 1.299 2021/01/31 17:15:38 tobhe Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
flowa->flow_local = &sa->sa_local;
flowa->flow_peer = &sa->sa_peer;
flowa->flow_ikesa = sa;
- if (ikev2_cp_fixflow(sa, flow, flowa) == -1)
+ if (ikev2_cp_fixflow(sa, flow, flowa) == -1) {
+ flow_free(flowa);
continue;
+ }
skip = 0;
TAILQ_FOREACH(saflow, &sa->sa_flows, flow_entry) {
sizeof(flow->flow_dst));
memcpy(&flowb->flow_dst, &flow->flow_src,
sizeof(flow->flow_src));
- if (ikev2_cp_fixflow(sa, flow, flowb) == -1)
+ if (ikev2_cp_fixflow(sa, flow, flowb) == -1) {
+ flow_free(flowa);
+ flow_free(flowb);
continue;
+ }
TAILQ_INSERT_TAIL(&sa->sa_flows, flowa, flow_entry);
TAILQ_INSERT_TAIL(&sa->sa_flows, flowb, flow_entry);