fix possible memleak

fix tiny leak if output options failed
This commit is contained in:
John Cupitt 2014-04-09 11:52:32 +01:00
parent a17ef9b7c8
commit daf075112d
2 changed files with 9 additions and 12 deletions

10
TODO
View File

@ -1,13 +1,3 @@
- try:
$ vips system "vips add %s %s %s" --in "k2.jpg k4.jpg" \
--out-format "%s.tif" --out x.v --log
memory: high-water mark 9.37 MB
""
memory: high-water mark 27.89 MB
$
but x.v does not appear
- can we use postbuild elsewhere? look at use of "preclose" / "written", etc.

View File

@ -793,10 +793,14 @@ vips_call_option_output( VipsObject *object,
result = vips_object_get_argument_to_string( object,
g_param_spec_get_name( pspec ), output->value );
return( result );
}
static void
vips_call_option_output_free( VipsObject *object, VipsCallOptionOutput *output )
{
VIPS_FREE( output->value );
g_free( output );
return( result );
}
static gboolean
@ -866,6 +870,9 @@ vips_call_options_set( const gchar *option_name, const gchar *value,
g_signal_connect( operation, "postbuild",
G_CALLBACK( vips_call_option_output ),
output );
g_signal_connect( operation, "close",
G_CALLBACK( vips_call_option_output_free ),
output );
}
return( TRUE );