]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Free up non-freed json memory on function return
authorDonald Sharp <sharpd@nvidia.com>
Tue, 13 Aug 2024 12:49:01 +0000 (08:49 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Tue, 13 Aug 2024 12:49:01 +0000 (08:49 -0400)
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>
bgpd/bgp_vty.c

index a3180fd707b91e4e82d9d563396ecbda2adc1e81..43e267c5e87190aa26e837e471705de0d5648a5b 100644 (file)
@@ -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);