]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospfd: fix crash show ip ospf border-routers json
authorChirag Shah <chirag@nvidia.com>
Sat, 21 Jan 2023 07:21:01 +0000 (23:21 -0800)
committerChirag Shah <chirag@nvidia.com>
Sat, 21 Jan 2023 07:24:44 +0000 (23:24 -0800)
When show ip ospf border-routers json (without vrf)
specificed, it leads to crash if there no border-routers
information.

Fix:
Do not free json object if use_vrf flag (means vrf option
is not passed) is not set.

Ticket:#3229017
Issue:3229017
Testing Done:

with fix:
l1# show ip ospf border-routers json
{
}
l1# show ip ospf vrf default border-routers json
{
}

Signed-off-by: Chirag Shah <chirag@nvidia.com>
ospfd/ospf_vty.c

index 12ccc8bceaaba8307ce4c2ec3f52c3808f43719a..f22c1e7e4ec4ddb9a70c3bd2e90a66c0ff3a054d 100644 (file)
@@ -11117,7 +11117,8 @@ static int show_ip_ospf_border_routers_common(struct vty *vty,
                        vty_out(vty, "No OSPF routing information exist\n");
                else {
                        json_object_free(json_router);
-                       json_object_free(json_vrf);
+                       if (use_vrf)
+                               json_object_free(json_vrf);
                }
                return CMD_SUCCESS;
        }