diff options
author | Ding Xiang <dingxiang@cmss.chinamobile.com> | 2023-08-15 10:49:15 +0300 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2023-08-16 16:17:06 +0300 |
commit | 46862da15e37efedb7d2d21e167f506c0b533772 (patch) | |
tree | 62285581b52eb485070aae96e041fd6cea5a8496 /tools/testing/selftests/arm64 | |
parent | 358b763ee64b11f45287c286e1f6145729ed49ab (diff) | |
download | linux-46862da15e37efedb7d2d21e167f506c0b533772.tar.xz |
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>
Diffstat (limited to 'tools/testing/selftests/arm64')
-rw-r--r-- | tools/testing/selftests/arm64/signal/testcases/zt_regs.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/arm64/signal/testcases/zt_regs.c b/tools/testing/selftests/arm64/signal/testcases/zt_regs.c index e1eb4d5c027a..2e384d731618 100644 --- a/tools/testing/selftests/arm64/signal/testcases/zt_regs.c +++ b/tools/testing/selftests/arm64/signal/testcases/zt_regs.c @@ -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; } |