From 360f9703f684e648d1d3b7b2942a4dbb7bab5fe9 Mon Sep 17 00:00:00 2001 From: "F. Aragon" Date: Fri, 3 Aug 2018 14:55:10 +0200 Subject: [PATCH] bgpd: rsc leak (Coverity 1472226 1472228 1472239) Signed-off-by: F. Aragon --- bgpd/bgp_debug.c | 16 +++++++++++----- bgpd/bgp_flowspec_vty.c | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 1e95a887bc..268356c7c3 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -1433,7 +1433,7 @@ DEFPY (debug_bgp_update_prefix_afi_safi, if (afiz == AFI_L2VPN && safiz == SAFI_EVPN) { ret = bgp_debug_parse_evpn_prefix(vty, argv, argc, &argv_p); if (ret != CMD_SUCCESS) - return ret; + goto cleanup; } else { (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p); apply_mask(argv_p); @@ -1446,7 +1446,7 @@ DEFPY (debug_bgp_update_prefix_afi_safi, vty_out(vty, "BGP updates debugging is already enabled for %s\n", argv[idx_ipv4_ipv6_prefixlen]->arg); - return CMD_SUCCESS; + goto cleanup; } bgp_debug_list_add_entry(bgp_debug_update_prefixes, NULL, argv_p); @@ -1459,7 +1459,10 @@ DEFPY (debug_bgp_update_prefix_afi_safi, argv[idx_ipv4_ipv6_prefixlen]->arg); } - return CMD_SUCCESS; +cleanup: + prefix_free(argv_p); + + return ret; } DEFPY (no_debug_bgp_update_prefix_afi_safi, @@ -1501,7 +1504,7 @@ DEFPY (no_debug_bgp_update_prefix_afi_safi, if (afiz == AFI_L2VPN && safiz == SAFI_EVPN) { ret = bgp_debug_parse_evpn_prefix(vty, argv, argc, &argv_p); if (ret != CMD_SUCCESS) - return ret; + goto cleanup; } else { (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p); apply_mask(argv_p); @@ -1530,7 +1533,10 @@ DEFPY (no_debug_bgp_update_prefix_afi_safi, vty_out(vty, "BGP updates debugging was not enabled for %s\n", argv[idx_ipv4_ipv6_prefixlen]->arg); - return CMD_SUCCESS; +cleanup: + prefix_free(argv_p); + + return ret; } diff --git a/bgpd/bgp_flowspec_vty.c b/bgpd/bgp_flowspec_vty.c index ace888c78d..f8c0613208 100644 --- a/bgpd/bgp_flowspec_vty.c +++ b/bgpd/bgp_flowspec_vty.c @@ -357,7 +357,7 @@ void route_vty_out_flowspec(struct vty *vty, struct prefix *p, if (unit) vty_out(vty, ")"); vty_out(vty, "\n"); - list_delete_all_node(list_bpm); + list_delete_and_null(&list_bpm); } else vty_out(vty, "\tnot installed in PBR\n"); } -- 2.39.5