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
This commit is contained in:
Brian Behlendorf 2021-01-22 16:17:16 -08:00
parent 7454d2bb8d
commit 6fc1ce0723
1 changed files with 1 additions and 0 deletions

View File

@ -468,6 +468,7 @@ efi_alloc_and_read(int fd, struct dk_gpt **vtoc)
(int) sizeof (struct dk_part) * (vptr->efi_nparts - 1); (int) sizeof (struct dk_part) * (vptr->efi_nparts - 1);
nparts = vptr->efi_nparts; nparts = vptr->efi_nparts;
if ((tmp = realloc(vptr, length)) == NULL) { if ((tmp = realloc(vptr, length)) == NULL) {
/* cppcheck-suppress doubleFree */
free(vptr); free(vptr);
*vtoc = NULL; *vtoc = NULL;
return (VT_ERROR); return (VT_ERROR);