diff --git a/frmts/gtiff/gtiffdataset_read.cpp b/frmts/gtiff/gtiffdataset_read.cpp index 623516edd361..81c587b0f167 100644 --- a/frmts/gtiff/gtiffdataset_read.cpp +++ b/frmts/gtiff/gtiffdataset_read.cpp @@ -3928,6 +3928,7 @@ GDALDataset *GTiffDataset::Open(GDALOpenInfo *poOpenInfo) "with the IGNORE_COG_LAYOUT_BREAK open option set " "to YES.", pszFilename); + XTIFFClose(l_hTIFF); delete poDS; return nullptr; }