diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 74f49a87ce42..3fb0413eb5be 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -4367,8 +4367,10 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, return -1; /* We either need nexthop(s) or an existing nexthop id */ - if (ng == NULL && re->nhe_id == 0) + if (ng == NULL && re->nhe_id == 0) { + XFREE(MTYPE_RE, re); return -1; + } /* * Use a temporary nhe to convey info to the common/main api.