mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-29 14:05:19 +08:00
kselftest/arm64: fix a memleak in zt_regs_run()
If memcmp() does not return 0, "zeros" need to be freed to prevent memleak Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com> Link: https://lore.kernel.org/r/20230815074915.245528-1-dingxiang@cmss.chinamobile.com Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
358b763ee6
commit
46862da15e
@ -65,6 +65,7 @@ int zt_regs_run(struct tdescr *td, siginfo_t *si, ucontext_t *uc)
|
||||
if (memcmp(zeros, (char *)zt + ZT_SIG_REGS_OFFSET,
|
||||
ZT_SIG_REGS_SIZE(zt->nregs)) != 0) {
|
||||
fprintf(stderr, "ZT data invalid\n");
|
||||
free(zeros);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user