summaryrefslogtreecommitdiff
path: root/drivers/bus/ifpga
diff options
context:
space:
mode:
authorRosen Xu <rosen.xu@intel.com>2018-05-22 18:26:17 +0800
committerThomas Monjalon <thomas@monjalon.net>2018-05-22 19:16:25 +0200
commit089818197459a899dbddc46c689a6fe53ecd5563 (patch)
tree6462b01a66ef034a0f387b581c21bb303683ef82 /drivers/bus/ifpga
parent07b4a8be61e9f0e2af2d15685ddf2f9eb5ba162e (diff)
downloaddpdk-089818197459a899dbddc46c689a6fe53ecd5563.zip
dpdk-089818197459a899dbddc46c689a6fe53ecd5563.tar.gz
dpdk-089818197459a899dbddc46c689a6fe53ecd5563.tar.xz
bus/ifpga: fix memory leaks in scan
There are some resource leaks in ifpga_scan_one. This patch fixes it. Coverity issue: 279459 Fixes: 05fa3d4a6539 ("bus/ifpga: add Intel FPGA bus library") Cc: stable@dpdk.org Signed-off-by: Rosen Xu <rosen.xu@intel.com>
Diffstat (limited to 'drivers/bus/ifpga')
-rw-r--r--drivers/bus/ifpga/ifpga_bus.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 675b9a3..db16173 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -156,27 +156,29 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
if (rawdev->dev_ops &&
rawdev->dev_ops->dev_start &&
rawdev->dev_ops->dev_start(rawdev))
- goto free_dev;
+ goto end;
strlcpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path));
if (rawdev->dev_ops->firmware_load &&
rawdev->dev_ops->firmware_load(rawdev,
&afu_pr_conf)){
IFPGA_BUS_ERR("firmware load error %d\n", ret);
- goto free_dev;
+ goto end;
}
afu_dev->id.uuid.uuid_low = afu_pr_conf.afu_id.uuid.uuid_low;
afu_dev->id.uuid.uuid_high = afu_pr_conf.afu_id.uuid.uuid_high;
+ rte_kvargs_free(kvlist);
+ free(path);
return afu_dev;
-free_dev:
- free(afu_dev);
end:
if (kvlist)
rte_kvargs_free(kvlist);
if (path)
free(path);
+ if (afu_dev)
+ free(afu_dev);
return NULL;
}