diff --git a/zebra/rib.h b/zebra/rib.h index 77d06762bc51..874021bd3201 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -337,6 +337,8 @@ extern void _route_entry_dump(const char *func, union prefixconstptr pp, union prefixconstptr src_pp, const struct route_entry *re); +void zebra_rib_route_entry_free(struct route_entry *re); + struct route_entry * zebra_rib_route_entry_new(vrf_id_t vrf_id, int type, uint8_t instance, uint32_t flags, uint32_t nhe_id, uint32_t table_id, diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 2f50e8b8c4de..de14bb3268c6 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -993,6 +993,8 @@ int netlink_route_change_read_unicast_internal(struct nlmsghdr *h, re, ng, startup, ctx); if (ng) nexthop_group_delete(&ng); + if (ctx) + zebra_rib_route_entry_free(re); } else { /* * I really don't see how this is possible diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 37814994abe7..16d7e957f933 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -4249,6 +4249,12 @@ struct route_entry *zebra_rib_route_entry_new(vrf_id_t vrf_id, int type, return re; } + +void zebra_rib_route_entry_free(struct route_entry *re) +{ + XFREE(MTYPE_RE, re); +} + /* * Internal route-add implementation; there are a couple of different public * signatures. Callers in this path are responsible for the memory they