pbrd: Fix memory leak in json output

Fix a memory leak in using some pbr json commands.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2020-11-04 09:11:13 -05:00
parent dc7b85a2f9
commit c195ae78e9

View File

@ -907,16 +907,22 @@ DEFPY (show_pbr_interface,
if (j)
this_iface = json_object_new_object();
if (!ifp->info)
if (!ifp->info) {
json_object_free(this_iface);
continue;
}
if (name && strcmp(ifp->name, name) != 0)
if (name && strcmp(ifp->name, name) != 0) {
json_object_free(this_iface);
continue;
}
pbr_ifp = ifp->info;
if (strcmp(pbr_ifp->mapname, "") == 0)
if (strcmp(pbr_ifp->mapname, "") == 0) {
json_object_free(this_iface);
continue;
}
pbrm = pbrm_find(pbr_ifp->mapname);