]> git.proxmox.com Git - mirror_frr.git/commit - ospfd/ospf_spf.c
ospfd: fix memory leak on SPF calculation
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 12 Dec 2022 18:11:27 +0000 (15:11 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 12 Dec 2022 18:16:45 +0000 (15:16 -0300)
commitb3bcfd3dc642a89419d8dbcc6080053b0209d85b
tree93353b48eae3bab87a16b0a4cab0bf08f8aee2a3
parentf2b72ef4740136a59a5bb81f8a8c654b092f8e54
ospfd: fix memory leak on SPF calculation

Fix the following problems:
- Always free vertex next hops on `vertex_parent_free`
- Signalize failure on `ospf_spf_add_parent` when parent already exists
  so the caller has the chance to `free()` any allocated resources.
- Don't reuse vertex next hops without the reference count logic in
  `ospf_nexthop_calculation`. Instead allocate a new copy so it can be
  `free()`d later without complications

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
ospfd/ospf_spf.c