Skip to content

Commit

Permalink
bgpd: Free up non-freed json memory on function return
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
donaldsharp committed Aug 13, 2024
1 parent c4fdc83 commit ce4e451
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ce4e451

Please sign in to comment.