提交 3902baf9 编写于 作者: G Gustavo A. R. Silva 提交者: David S. Miller

netdevsim: dev: Fix memory leak in nsim_dev_take_snapshot_write

In case memory resources for dummy_data were allocated, release them
before return.

Addresses-Coverity-ID: 1491997 ("Resource leak")
Fixes: 7ef19d3b ("devlink: report error once U32_MAX snapshot ids have been used")
Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: NJakub Kicinski <kuba@kernel.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1a795da7
......@@ -75,6 +75,7 @@ static ssize_t nsim_dev_take_snapshot_write(struct file *file,
err = devlink_region_snapshot_id_get(devlink, &id);
if (err) {
pr_err("Failed to get snapshot id\n");
kfree(dummy_data);
return err;
}
err = devlink_region_snapshot_create(nsim_dev->dummy_region,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册