]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_vty.c
ospfd: Fix memory leaks w/ `show ip ospf int X json` commands
[mirror_frr.git] / ospfd / ospf_vty.c
index 09dd0081ebd122cf7a3da461e450151ff3ce959e..1b4d26ef3d07f8f72d2558a497006f9ae750a8ba 100644 (file)
@@ -3996,16 +3996,15 @@ static int show_ip_ospf_interface_common(struct vty *vty, struct ospf *ospf,
                /* Interface name is specified. */
                ifp = if_lookup_by_name(intf_name, ospf->vrf_id);
                if (ifp == NULL) {
-                       if (use_json)
+                       if (use_json) {
                                json_object_boolean_true_add(json_vrf,
                                                             "noSuchIface");
-                       else
+                               json_object_free(json_interface);
+                       } else
                                vty_out(vty, "No such interface name\n");
                } else {
-                       if (use_json) {
+                       if (use_json)
                                json_interface_sub = json_object_new_object();
-                               json_interface = json_object_new_object();
-                       }
 
                        show_ip_ospf_interface_sub(
                                vty, ospf, ifp, json_interface_sub, use_json);