]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix additional issue with bgp route-leak json commit
authorDon Slice <dslice@cumulusnetworks.com>
Mon, 20 Aug 2018 21:05:57 +0000 (21:05 +0000)
committerDon Slice <dslice@cumulusnetworks.com>
Mon, 20 Aug 2018 21:05:57 +0000 (21:05 +0000)
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
bgpd/bgp_vty.c

index 984c602002dedad1105f8529c285e081fae90c24..98d9ffccebff27ce4256826e06cb87df7414173c 100644 (file)
@@ -11010,8 +11010,6 @@ static int bgp_show_route_leak_vty(struct vty *vty, const char *name,
                json_object *json_export_vrfs = NULL;
 
                json = json_object_new_object();
-               json_import_vrfs = json_object_new_array();
-               json_export_vrfs = json_object_new_array();
 
                /* Provide context for the block */
                json_object_string_add(json, "vrf", name ? name : "default");
@@ -11036,8 +11034,9 @@ static int bgp_show_route_leak_vty(struct vty *vty, const char *name,
                                BGP_CONFIG_VRF_TO_VRF_IMPORT)) {
                        json_object_string_add(json, "importFromVrfs", "none");
                        json_object_string_add(json, "importRts", "none");
-                       json_object_free(json_import_vrfs);
                } else {
+                       json_import_vrfs = json_object_new_array();
+
                        for (ALL_LIST_ELEMENTS_RO(
                                                bgp->vpn_policy[afi].import_vrf,
                                                node, vname))
@@ -11061,8 +11060,9 @@ static int bgp_show_route_leak_vty(struct vty *vty, const char *name,
                        json_object_string_add(json, "routeDistinguisher",
                                               "none");
                        json_object_string_add(json, "exportRts", "none");
-                       json_object_free(json_export_vrfs);
                } else {
+                       json_export_vrfs = json_object_new_array();
+
                        for (ALL_LIST_ELEMENTS_RO(
                                                bgp->vpn_policy[afi].export_vrf,
                                                node, vname))