]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: fix json double free when showing neighbors
authorQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 17 Dec 2018 22:18:13 +0000 (22:18 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 17 Dec 2018 22:23:41 +0000 (22:23 +0000)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
bgpd/bgp_vty.c

index 8d3a485d5b748e629048c379364fbd1f2541f973..e54a873e15f2590a574d4f055fbd11107253fc83 100644 (file)
@@ -10730,7 +10730,6 @@ static int bgp_show_neighbor(struct vty *vty, struct bgp *bgp,
        if (use_json) {
                vty_out(vty, "%s\n", json_object_to_json_string_ext(
                                             json, JSON_C_TO_STRING_PRETTY));
-               json_object_free(json);
        } else {
                vty_out(vty, "\n");
        }
@@ -10803,8 +10802,10 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty,
                }
        }
 
-       if (use_json)
+       if (use_json) {
                vty_out(vty, "}\n");
+               json_object_free(json);
+       }
 }
 
 static int bgp_show_neighbor_vty(struct vty *vty, const char *name,