aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libefi
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2021-01-22 16:17:16 -0800
committerBrian Behlendorf <[email protected]>2021-01-26 16:12:02 -0800
commit6fc1ce07239f17a1262e87a334325d60da34d7a1 (patch)
tree0b9b81433651114284aaee6051f581d170f25199 /lib/libefi
parent7454d2bb8d860bb49353c8b60dc980de82296f73 (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 <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11508
Diffstat (limited to 'lib/libefi')
-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);