diff options
| author | Hongtao Lee <lihongtao@kylinos.cn> | 2026-05-20 11:01:26 +0800 |
|---|---|---|
| committer | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-05-21 11:42:27 +0900 |
| commit | f42d01aadcedd7bbf4f9a466cabe25c1781dedad (patch) | |
| tree | 5e6a127c2b57f0bb50ae80e0522b6b5bb72a6281 | |
| parent | 5200f5f493f79f14bbdc349e402a40dfb32f23c8 (diff) | |
tools/bootconfig: Fix buf leaks in apply_xbc
If data calloc failed, free the buf before return.
Link: https://lore.kernel.org/all/20260520030126.147782-1-lihongtao@kylinos.cn/
Fixes: 950313ebf79c ("tools: bootconfig: Add bootconfig command")
Signed-off-by: Hongtao Lee <lihongtao@kylinos.cn>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
| -rw-r--r-- | tools/bootconfig/main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c index 643f707b8f1d..ddabde20585f 100644 --- a/tools/bootconfig/main.c +++ b/tools/bootconfig/main.c @@ -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 */ |
