Skip to content

Conversation

soumyar-roy
Copy link
Contributor

During ecommunity_replace_linkbw, we are not freeing old ecom memory. Similar thing handled in
bgp_path_info_mpath_aggregate_update

@soumyar-roy soumyar-roy marked this pull request as draft October 6, 2025 17:37
struct community *old_comm = bgp_attr_get_community(&attr);
if (old_comm && !old_comm->refcnt)
community_free(&old_comm);
bgp_attr_set_community(&attr, community);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is a regular problem, why not do this inside "set_community", "set_ecommunity", etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats the right way to do. I tried to do that, but two things I faced , 1) many places they have local free, so I need to change all of them to handle double free 2) all of bgp_attr_set_* are inline functions.., if we are fine for both then I can change accordingly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is far preferable to fix the problem once and right such that people coming along behind do not re-introduce the problem or use a pattern that is broken.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, that if this can be fixed completely (bad pattern), then let's do it now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I will make change accordingly.

During  ecommunity_replace_linkbw, we are not freeing
old ecom memory.  Similar thing handled in
bgp_path_info_mpath_aggregate_update

Signed-off-by: Soumya Roy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants