Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra: The dplane_fpm_nl return path leaks memory #14983

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions zebra/rib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions zebra/rt_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,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
Expand Down
6 changes: 6 additions & 0 deletions zebra/zebra_rib.c
Original file line number Diff line number Diff line change
Expand Up @@ -4305,6 +4305,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
Expand Down
Loading