summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_vty.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-08-13 14:49:01 +0200
committerDonald Sharp <sharpd@nvidia.com>2024-08-13 14:49:01 +0200
commitce4e451c5b86d3f79c88283e2a7425ce32e9df1b (patch)
treeae5b2e8e4c693d32dd8ff0870bba134d94443064 /bgpd/bgp_vty.c
parentMerge pull request #16534 from opensourcerouting/fix/start_ldpd_if_unified (diff)
downloadfrr-ce4e451c5b86d3f79c88283e2a7425ce32e9df1b.tar.xz
frr-ce4e451c5b86d3f79c88283e2a7425ce32e9df1b.zip
bgpd: Free up non-freed json memory on function return
json_peers is allocated in the above if statement block for json but is not freed in this code path. Noticed by running Address Sanitizer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to '')
-rw-r--r--bgpd/bgp_vty.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index a3180fd70..43e267c5e 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -12046,6 +12046,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
if (show_failed && !failed_count) {
if (use_json) {
+ json_object_free(json_peers);
+
json_object_int_add(json, "failedPeersCount", 0);
json_object_int_add(json, "dynamicPeers", dn_count);
json_object_int_add(json, "totalPeers", count);