fix another tiny ref leak

This commit is contained in:
John Cupitt 2012-07-14 13:05:58 +01:00
parent 73f8263286
commit cbe0dcf797
3 changed files with 18 additions and 5 deletions

View File

@ -67,10 +67,14 @@ im__value( IMAGE *im, double *value )
{
IMAGE *t;
if( !(t = im_open_local( im, "im__value", "p" )) ||
im_extract_areabands( im, t, 0, 0, 1, 1, 0, 1 ) ||
im_avg( t, value ) )
if( !(t = im_open( "im__value", "p" )) )
return( -1 );
if( im_extract_areabands( im, t, 0, 0, 1, 1, 0, 1 ) ||
im_avg( t, value ) ) {
im_close( t );
return( -1 );
}
im_close( t );
return( 0 );
}

View File

@ -65,6 +65,7 @@ int
im_point( IMAGE *im, VipsInterpolate *interpolate,
double x, double y, int band, double *out )
{
IMAGE *mem;
IMAGE *t[2];
if( band >= im->Bands ||
@ -75,15 +76,20 @@ im_point( IMAGE *im, VipsInterpolate *interpolate,
return( -1 );
}
if( im_open_local_array( im, t, 2, "im_point_bilinear", "p" ) ||
if( !(mem = im_open( "im_point", "p" )) )
return( -1 );
if( im_open_local_array( mem, t, 2, "im_point", "p" ) ||
im_extract_band( im, t[0], band ) ||
im_affinei( t[0], t[1],
interpolate,
1, 0, 0, 1,
x - floor( x ), y - floor( y ),
floor( x ), floor( y ), 1, 1 ) ||
im_avg( t[1], out ) )
im_avg( t[1], out ) ) {
im_close( mem );
return( -1 );
}
im_close( mem );
return( 0 );
}

View File

@ -223,6 +223,9 @@ vips__vector_to_ink( const char *domain, VipsImage *im, double *vec, int n )
if( vips_check_vector( domain, n, im ) )
return( NULL );
/* This looks a bit dodgy, but the pipeline we are creating does not
* depend upon im, so it's OK to make t depend on im.
*/
t = (VipsImage **) vips_object_local_array( VIPS_OBJECT( im ), 4 );
ones = VIPS_ARRAY( im, n, double );
for( i = 0; i < n; i++ )