]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix userspace memory leaks found by Clang Static Analzyer
authorRichard Yao <richard.yao@alumni.stonybrook.edu>
Tue, 27 Sep 2022 00:18:05 +0000 (20:18 -0400)
committerGitHub <noreply@github.com>
Tue, 27 Sep 2022 00:18:05 +0000 (17:18 -0700)
commitf7bda2de9786017348fd814603735f2be4182825
treef24898dc331701ab3974068d4d2735d17f5bb35e
parent5e7a2f4665b5be32dab9c183e6fdb94e1f434b70
Fix userspace memory leaks found by Clang Static Analzyer

Recently, I have been making a push to fix things that coverity found.
However, I was curious what Clang's static analyzer reported, so I ran
it and found things that coverity had missed.

* contrib/pam_zfs_key/pam_zfs_key.c: If prop_mountpoint is passed more
  than once, we leak memory.
* module/zfs/zcp_get.c: We leak memory on temporary properties in
  userspace.
* tests/zfs-tests/cmd/draid.c: On error from vdev_draid_rand(), we leak
  memory if best_map had been allocated by a prior iteration.
* tests/zfs-tests/cmd/mkfile.c: Memory used by the loop is not freed
  before program termination.

Arguably, these are all minor issues, but if we ignore them, then they
could obscure serious bugs, so we fix them.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13955
contrib/pam_zfs_key/pam_zfs_key.c
module/zfs/zcp_get.c
tests/zfs-tests/cmd/draid.c
tests/zfs-tests/cmd/mkfile.c