diff --git a/modules/imgcodecs/src/jpeg_exif.cpp b/modules/imgcodecs/src/jpeg_exif.cpp index 61b27bbf90..adb87e5b77 100644 --- a/modules/imgcodecs/src/jpeg_exif.cpp +++ b/modules/imgcodecs/src/jpeg_exif.cpp @@ -170,6 +170,7 @@ std::map ExifReader::getExif() case APP1: //actual Exif Marker exifSize = getFieldSize(f); if (exifSize <= offsetToTiffHeader) { + fclose(f); throw ExifParsingError(); } m_data.resize( exifSize - offsetToTiffHeader );