Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
route-table: Fix potential memory leak.
As highlighted by static analysis [0], a potential memory leak was introduced in the commit referenced in the fixes tag. The issue was introduced by what I can describe as premature optimization, and while very unlikely to hit, let's make the code correct. The logic for cleanup assumes rdnh will always be added to the list of nexthops, and then I apparently chose to skip that when processing the outer message with a RTA_MULTIPATH attribute, presumably because its nexthop attributes will be added when processing nested attributes, making the list addition redundant. Skipping the list addition was technically safe, because at this point rdnh would be pointing at primary_next_hop__ on the stack. Separate out the nexthop cleanup code in private helper for internal use, while this is the only action for the public route_data_destroy() today, it might grow other powers in the future. Always add rdnh to list of nexthops and remove it when processing RTA_MULTIPATH nested attributes. 0: https://mail.openvswitch.org/pipermail/ovs-dev/2025-January/419818.html Fixes: 91fc511 ("route-table: Support parsing multipath routes.") Signed-off-by: Frode Nordahl <[email protected]> Signed-off-by: 0-day Robot <[email protected]>
- Loading branch information