diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2024-06-26 13:21:38 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2024-08-27 06:25:34 -0400 |
| commit | 9bc0cd8241f39e4fd751edfa52c09fae6db2db1c (patch) | |
| tree | 927b634c06c3dc7f269cae17020cfd954461ec39 /zebra/zebra_rib.c | |
| parent | d528c02a204086da0d542d5655b8724de681a65c (diff) | |
zebra: Prevent accidental re memory leak in odd case
There exists a path in rib_add_multipath where if a decision
is made to not use the passed in re, we just drop the memory
instead of freeing it. Let's free it.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra/zebra_rib.c')
| -rw-r--r-- | zebra/zebra_rib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 2d6c514883..b4baee148a 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -4375,8 +4375,10 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, return -1; /* We either need nexthop(s) or an existing nexthop id */ - if (ng == NULL && re->nhe_id == 0) + if (ng == NULL && re->nhe_id == 0) { + zebra_rib_route_entry_free(re); return -1; + } /* * Use a temporary nhe to convey info to the common/main api. |
