mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-11-01 10:46:46 +00:00
Merge pull request #12677 from opensourcerouting/fix/ospf_potential_memory_leak
ospfd: Free memory for JSON allocated object before return
This commit is contained in:
commit
c6188284fb
@ -7314,16 +7314,26 @@ static int show_ip_ospf_database_type_adv_router_common(struct vty *vty,
|
||||
type = OSPF_OPAQUE_AREA_LSA;
|
||||
else if (strncmp(argv[arg_base + idx_type]->text, "opaque-as", 9) == 0)
|
||||
type = OSPF_OPAQUE_AS_LSA;
|
||||
else
|
||||
else {
|
||||
if (uj) {
|
||||
if (use_vrf)
|
||||
json_object_free(json_vrf);
|
||||
}
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
/* `show ip ospf database LSA adv-router ADV_ROUTER'. */
|
||||
if (strncmp(argv[arg_base + 5]->text, "s", 1) == 0)
|
||||
adv_router = ospf->router_id;
|
||||
else {
|
||||
ret = inet_aton(argv[arg_base + 6]->arg, &adv_router);
|
||||
if (!ret)
|
||||
if (!ret) {
|
||||
if (uj) {
|
||||
if (use_vrf)
|
||||
json_object_free(json_vrf);
|
||||
}
|
||||
return CMD_WARNING;
|
||||
}
|
||||
}
|
||||
|
||||
show_lsa_detail_adv_router(vty, ospf, type, &adv_router, json_vrf);
|
||||
@ -7387,9 +7397,12 @@ DEFUN (show_ip_ospf_database_type_adv_router,
|
||||
} else {
|
||||
ospf = ospf_lookup_by_inst_name(inst, vrf_name);
|
||||
if ((ospf == NULL) || !ospf->oi_running) {
|
||||
vty_out(vty,
|
||||
"%% OSPF is not enabled in vrf %s\n",
|
||||
vrf_name);
|
||||
if (uj)
|
||||
vty_json(vty, json);
|
||||
else
|
||||
vty_out(vty,
|
||||
"%% OSPF is not enabled in vrf %s\n",
|
||||
vrf_name);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -7400,7 +7413,11 @@ DEFUN (show_ip_ospf_database_type_adv_router,
|
||||
/* Display default ospf (instance 0) info */
|
||||
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
|
||||
if (ospf == NULL || !ospf->oi_running) {
|
||||
vty_out(vty, "%% OSPF is not enabled on vrf default\n");
|
||||
if (uj)
|
||||
vty_json(vty, json);
|
||||
else
|
||||
vty_out(vty,
|
||||
"%% OSPF is not enabled on vrf default\n");
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -11274,7 +11291,12 @@ static int show_ip_ospf_route_common(struct vty *vty, struct ospf *ospf,
|
||||
ospf_show_vrf_name(ospf, vty, json_vrf, use_vrf);
|
||||
|
||||
if (ospf->new_table == NULL) {
|
||||
vty_out(vty, "No OSPF routing information exist\n");
|
||||
if (json) {
|
||||
if (use_vrf)
|
||||
json_object_free(json_vrf);
|
||||
} else {
|
||||
vty_out(vty, "No OSPF routing information exist\n");
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user