summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <behlendorf1@llnl.gov>2021-01-22 16:17:16 -0800
committerTony Hutter <hutter2@llnl.gov>2021-11-12 16:31:55 -0800
commit1a4030b1b543d3fe83a710c0d3b0563f42b8c470 (patch)
tree038e3e66ab9c8f2e6f376456c911795b70f9e4ee
parent33fa3985a9791a6dcd2ee60ac9ea21486d068c0f (diff)
cppcheck: resolve double free
The double free reported for the realloc() failure branch is a false positive. It should be resolved in cppcheck 2.4 but for the benefit of older versions we supress the warning. https://trac.cppcheck.net/ticket/9292 Reviewed-by: Ryan Moeller <ryan@ixsystems.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #11508
-rw-r--r--lib/libefi/rdwr_efi.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libefi/rdwr_efi.c b/lib/libefi/rdwr_efi.c
index 14bf57aa1..ca7a760b6 100644
--- a/lib/libefi/rdwr_efi.c
+++ b/lib/libefi/rdwr_efi.c
@@ -468,6 +468,7 @@ efi_alloc_and_read(int fd, struct dk_gpt **vtoc)
(int) sizeof (struct dk_part) * (vptr->efi_nparts - 1);
nparts = vptr->efi_nparts;
if ((tmp = realloc(vptr, length)) == NULL) {
+ /* cppcheck-suppress doubleFree */
free(vptr);
*vtoc = NULL;
return (VT_ERROR);