ospfd: Fix possible crash and wrong data being shown

When you have more than one ospf interface configured
to be used, we were attempting to reuse the
json_interface_sub pointer after we added it
to the json data structure.

Ticket: CM-13597
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2016-11-16 11:28:11 -05:00
parent c22767d89e
commit 70a4754dd0

View File

@ -3967,10 +3967,15 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc,
{
show_ip_ospf_interface_sub (vty, ospf, ifp, json_interface_sub, use_json);
if (use_json)
{
json_object_object_add(json, ifp->name, json_interface_sub);
json_interface_sub = json_object_new_object ();
}
}
}
if (use_json)
json_object_free (json_interface_sub);
}
else
{
/* Interface name is specified. */