From 76dd2d3910f05722970c4a115a49b2a968e6cdda Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 20 Dec 2019 14:12:25 +0000 Subject: [PATCH] fix profile removal we had a possible shared image --- libvips/foreign/foreign.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index 129dd1b9..e6bd7604 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -1596,8 +1596,19 @@ vips__foreign_convert_saveable( VipsImage *in, VipsImage **ready, if( !vips_image_get_blob( in, VIPS_META_ICC_NAME, &data, &length ) && - !vips_icc_is_compatible_profile( in, data, length ) ) + !vips_icc_is_compatible_profile( in, data, length ) ) { + VipsImage *out; + + if( vips_copy( in, &out, NULL ) ) { + g_object_unref( in ); + return( -1 ); + } + g_object_unref( in ); + + in = out; + vips_image_remove( in, VIPS_META_ICC_NAME ); + } } *ready = in;