mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
octeontx2-af: Fix memory leak of object buf
[ Upstream commit9e0a537d06] 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:f788409714("octeontx2-af: Formatting debugfs entry rsrc_alloc.") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Sunil Goutham <sgoutham@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
558454ec51
commit
889c56ea94
@@ -163,8 +163,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++)
|
||||
|
||||
Reference in New Issue
Block a user