From 7865c65d23d296364c9430645202fbeeb5fb8390 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Tue, 5 Sep 2017 08:21:31 -0300 Subject: [PATCH] zebra: plug memory leak in rib_add_multipath() Signed-off-by: Renato Westphal --- zebra/zebra_rib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 7c140598c2..297a4ab95b 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2223,10 +2223,11 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, assert(!src_p || afi == AFI_IP6); /* Lookup table. */ - table = zebra_vrf_table_with_table_id(afi, safi, re->vrf_id, - re->table); - if (!table) + table = zebra_vrf_table_with_table_id(afi, safi, re->vrf_id, re->table); + if (!table) { + XFREE(MTYPE_RE, re); return 0; + } /* Make it sure prefixlen is applied to the prefix. */ apply_mask(p); -- 2.39.5