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:
parent
7454d2bb8d
commit
6fc1ce0723
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue