From 163076686edf41dfd77b889de1227334977ba070 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Wed, 26 Jul 2017 12:27:37 -0300 Subject: [PATCH] bgpd/ospfd: fix json leaks and blank output Signed-off-by: Renato Westphal --- bgpd/bgp_evpn_vty.c | 2 ++ bgpd/bgp_mplsvpn.c | 2 ++ bgpd/bgp_route.c | 4 ++++ bgpd/bgp_vpn.c | 2 ++ ospfd/ospf_vty.c | 8 ++++++++ 5 files changed, 18 insertions(+) diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 4b39ee8627..1225354c0a 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -347,6 +347,8 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd, if (bgp == NULL) { if (!use_json) vty_out(vty, "No BGP process is configured\n"); + else + vty_out(vty, "{}\n"); return CMD_WARNING; } diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 5d2966d1ad..baf081c815 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -374,6 +374,8 @@ int bgp_show_mpls_vpn(struct vty *vty, afi_t afi, struct prefix_rd *prd, if (bgp == NULL) { if (!use_json) vty_out(vty, "No BGP process is configured\n"); + else + vty_out(vty, "{}\n"); return CMD_WARNING; } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 7cdc839618..b554aeb32b 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8257,6 +8257,8 @@ static int bgp_show(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, if (bgp == NULL) { if (!use_json) vty_out(vty, "No BGP process is configured\n"); + else + vty_out(vty, "{}\n"); return CMD_WARNING; } @@ -8622,6 +8624,8 @@ static int bgp_show_route(struct vty *vty, struct bgp *bgp, const char *ip_str, if (!bgp) { if (!use_json) vty_out(vty, "No BGP process is configured\n"); + else + vty_out(vty, "{}\n"); return CMD_WARNING; } } diff --git a/bgpd/bgp_vpn.c b/bgpd/bgp_vpn.c index ca98ff0668..4661e195a2 100644 --- a/bgpd/bgp_vpn.c +++ b/bgpd/bgp_vpn.c @@ -51,6 +51,8 @@ int show_adj_route_vpn(struct vty *vty, struct peer *peer, if (bgp == NULL) { if (!use_json) vty_out(vty, "No BGP process is configured\n"); + else + vty_out(vty, "{}\n"); return CMD_WARNING; } diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 55d6c27e8c..a8bfb669af 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -4402,6 +4402,10 @@ static int show_ip_ospf_neighbor_id_common(struct vty *vty, struct ospf *ospf, if (!ret) { if (!use_json) vty_out(vty, "Please specify Neighbor ID by A.B.C.D\n"); + else { + vty_out(vty, "{}\n"); + json_object_free(json); + } return CMD_WARNING; } @@ -4682,6 +4686,10 @@ static int show_ip_ospf_neighbor_int_detail_common(struct vty *vty, if (!ifp) { if (!use_json) vty_out(vty, "No such interface.\n"); + else { + vty_out(vty, "{}\n"); + json_object_free(json); + } return CMD_WARNING; } -- 2.39.5