bgpd: Fix memory use after free

We were immediately using memory after it was freed.  Fix.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2018-05-30 17:55:04 -04:00
parent 3292693b2f
commit 122eebd85a

View File

@ -207,9 +207,9 @@ static void bgp_info_free(struct bgp_info *binfo)
{
/* unlink reference to parent, if any. */
if (binfo->extra && binfo->extra->parent) {
bgp_info_unlock((struct bgp_info *)binfo->extra->parent);
bgp_unlock_node((struct bgp_node *)((struct bgp_info *)binfo
->extra->parent)->net);
bgp_info_unlock((struct bgp_info *)binfo->extra->parent);
binfo->extra->parent = NULL;
}