Merge pull request #14988 from FRRouting/mergify/bp/stable/9.1/pr-14983

zebra: The dplane_fpm_nl return path leaks memory (backport #14983)
This commit is contained in:
Donatas Abraitis 2023-12-12 16:30:21 +02:00 committed by GitHub
commit 7163844e77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -345,6 +345,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,

View File

@ -1025,6 +1025,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

View File

@ -4267,6 +4267,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