Commit 9e0a537d authored by Colin Ian King's avatar Colin Ian King Committed by David S. Miller

octeontx2-af: Fix memory leak of object buf

Currently the error return path when lfs fails to allocate is not free'ing
the memory allocated to buf. Fix this by adding the missing kfree.

Addresses-Coverity: ("Resource leak")
Fixes: f7884097 ("octeontx2-af: Formatting debugfs entry rsrc_alloc.")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarSunil Goutham <sgoutham@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f51d7bf1
......@@ -253,8 +253,10 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp,
return -ENOSPC;
lfs = kzalloc(lf_str_size, GFP_KERNEL);
if (!lfs)
if (!lfs) {
kfree(buf);
return -ENOMEM;
}
off += scnprintf(&buf[off], buf_size - 1 - off, "%-*s", lf_str_size,
"pcifunc");
for (index = 0; index < BLK_COUNT; index++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment