From 0296d7c154d05e745c55aa4d22ceef894e1c9d8c Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 7 Feb 2021 16:05:00 +0000 Subject: [PATCH] fix ref leak on ppm save introduced a few days ago --- libvips/foreign/ppmsave.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libvips/foreign/ppmsave.c b/libvips/foreign/ppmsave.c index 94529eb4..c5adc14c 100644 --- a/libvips/foreign/ppmsave.c +++ b/libvips/foreign/ppmsave.c @@ -315,8 +315,11 @@ vips_foreign_save_ppm( VipsForeignSavePpm *ppm, VipsImage *image ) if( vips__byteswap_bool( image, &x, !vips_amiMSBfirst() ) ) return( -1 ); - VIPS_UNREF( image ); image = x; + + /* image must now be unreffed on exit. + */ + vips_object_local( VIPS_OBJECT( ppm->target ), image ); } if( vips_sink_disc( image, vips_foreign_save_ppm_block, ppm ) )