From 70a4754dd0eec88e0294c645d7c93d08e4356dda Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 16 Nov 2016 11:28:11 -0500 Subject: [PATCH] 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 --- ospfd/ospf_vty.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 2724df98a0..b13c28d0c9 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -3967,9 +3967,14 @@ 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_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 {