diff --git a/libvips/foreign/openexr2vips.c b/libvips/foreign/openexr2vips.c index 8e113634..817f8091 100644 --- a/libvips/foreign/openexr2vips.c +++ b/libvips/foreign/openexr2vips.c @@ -14,6 +14,8 @@ * - redo as a set of fns ready for wrapping in a new-style class * 17/9/16 * - tag output as scRGB + * 16/8/18 + * - shut down the input file as soon as we can [kleisauke] */ /* @@ -121,13 +123,19 @@ get_imf_error( void ) vips_error( "exr2vips", _( "EXR error: %s" ), ImfErrorMessage() ); } +static void +read_close( Read *read ) +{ + VIPS_FREEF( ImfCloseTiledInputFile, read->tiles ); + VIPS_FREEF( ImfCloseInputFile, read->lines ); +} + static void read_destroy( VipsImage *out, Read *read ) { VIPS_FREE( read->filename ); - VIPS_FREEF( ImfCloseTiledInputFile, read->tiles ); - VIPS_FREEF( ImfCloseInputFile, read->lines ); + read_close( read ); vips_free( read ); } @@ -329,6 +337,11 @@ vips__openexr_generate( VipsRegion *out, } } + /* We can't shut down the input file early for tile read, even if we + * know load is in sequential mode, since we are not inside a + * vips_sequential() and requests are not guaranteed to be in order. + */ + return( 0 ); } @@ -408,6 +421,8 @@ vips__openexr_read( const char *filename, VipsImage *out ) (VipsPel *) vips_buffer ) ) return( -1 ); } + + read_close( read ); } return( 0 ); diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 5b8b2c97..f05fd4e9 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -1632,7 +1632,7 @@ rtiff_fill_region( VipsRegion *out, /* We can't shut down the input file early for tile read, even if we * know load is in sequential mode, since we are not inside a - * vips_sequential() and requests are not guarateed to be in order. + * vips_sequential() and requests are not guaranteed to be in order. */ return( 0 );