diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-12-19 08:20:30 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-12-19 08:20:30 -0500 |
| commit | 449feb8ef98347c28148af86dbcbaad35070a8ad (patch) | |
| tree | 0256681c9916d1ce1d84d8feb501c1edff9a7e14 | |
| parent | fb8f41e455aec592eebcc4ccf4716e0c853133a6 (diff) | |
bgpd: Fix double free
The json code was freeing json_paths and then
turning around and free'ing it again. Newer
versions of json-c have started to assert
this bad behavior.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| -rw-r--r-- | bgpd/bgp_route.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 2323572488..09759628cb 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8396,6 +8396,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, vty_out(vty, "%s", json_object_to_json_string_ext(json_paths, JSON_C_TO_STRING_PRETTY)); json_object_free(json_paths); + json_paths = NULL; first = 0; } } @@ -8409,7 +8410,8 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, *total_cum = total_count; } if (use_json) { - json_object_free(json_paths); + if (json_paths) + json_object_free(json_paths); if (is_last) vty_out(vty, " } }\n"); else |
