From ab6bb83266a83a575ed50c0bf43cf8f91ce5e17d Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 10 Nov 2016 11:09:49 +0000 Subject: [PATCH] fix a memleak in exif parsing --- TODO | 3 --- libvips/foreign/exif.c | 9 ++++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index bfa3a956..715f4c8f 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,3 @@ -- test under valgrind - - - not sure about utf8 error messages on win - strange: diff --git a/libvips/foreign/exif.c b/libvips/foreign/exif.c index 55ad5694..e07d5fe8 100644 --- a/libvips/foreign/exif.c +++ b/libvips/foreign/exif.c @@ -366,15 +366,16 @@ vips_image_resolution_from_exif( VipsImage *image, ExifData *ed ) /* The main image xres/yres are in ifd0. ifd1 has xres/yres of the * image thumbnail, if any. + * + * Don't warn about missing res fields, it's very common, especially for + * things like webp. */ if( vips_exif_entry_get_double( ed, 0, EXIF_TAG_X_RESOLUTION, &xres ) || vips_exif_entry_get_double( ed, 0, EXIF_TAG_Y_RESOLUTION, &yres ) || vips_exif_entry_get_int( ed, - 0, EXIF_TAG_RESOLUTION_UNIT, &unit ) ) { - vips_warn( "exif", "%s", _( "error reading resolution" ) ); + 0, EXIF_TAG_RESOLUTION_UNIT, &unit ) ) return( -1 ); - } #ifdef DEBUG printf( "vips_image_resolution_from_exif: seen exif tags " @@ -1106,6 +1107,8 @@ vips__exif_update( VipsImage *image ) vips_image_set_blob( image, VIPS_META_EXIF_NAME, (VipsCallbackFn) vips_free, data, length ); + exif_data_free( ed ); + return( 0 ); }