From 6fc1ce07239f17a1262e87a334325d60da34d7a1 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 22 Jan 2021 16:17:16 -0800 Subject: [PATCH] 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 Signed-off-by: Brian Behlendorf Closes #11508 --- lib/libefi/rdwr_efi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libefi/rdwr_efi.c b/lib/libefi/rdwr_efi.c index 14bf57aa1cd..ca7a760b649 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); -- 2.45.0