mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
tools/bootconfig: Fix buf leaks in apply_xbc
[ Upstream commitf42d01aadc] If data calloc failed, free the buf before return. Link: https://lore.kernel.org/all/20260520030126.147782-1-lihongtao@kylinos.cn/ Fixes:950313ebf7("tools: bootconfig: Add bootconfig command") Signed-off-by: Hongtao Lee <lihongtao@kylinos.cn> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b470204941
commit
bebc7dc0fb
@@ -390,8 +390,10 @@ static int apply_xbc(const char *path, const char *xbc_path)
|
||||
|
||||
/* Backup the bootconfig data */
|
||||
data = calloc(size + BOOTCONFIG_ALIGN + BOOTCONFIG_FOOTER_SIZE, 1);
|
||||
if (!data)
|
||||
if (!data) {
|
||||
free(buf);
|
||||
return -ENOMEM;
|
||||
}
|
||||
memcpy(data, buf, size);
|
||||
|
||||
/* Check the data format */
|
||||
|
||||
Reference in New Issue
Block a user