summaryrefslogtreecommitdiffstats
path: root/pbrd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-11-04 15:11:13 +0100
committerDonald Sharp <sharpd@nvidia.com>2020-11-04 15:11:13 +0100
commitc195ae78e957c4783e078d4b2eff0065f76e817c (patch)
tree468b4d6691568190b715ca4f0ffb20d76855bfbc /pbrd
parentMerge pull request #7274 from donaldsharp/bgp_best_is_a_path (diff)
downloadfrr-c195ae78e957c4783e078d4b2eff0065f76e817c.tar.xz
frr-c195ae78e957c4783e078d4b2eff0065f76e817c.zip
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>
Diffstat (limited to 'pbrd')
-rw-r--r--pbrd/pbr_vty.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c
index eb51516c2..26163dcc5 100644
--- a/pbrd/pbr_vty.c
+++ b/pbrd/pbr_vty.c
@@ -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);