Commit 5efbd6a1 authored by Rémi Duraffort's avatar Rémi Duraffort

Fix potential object leak (test the conditions before doing anything).

parent 27edb261
......@@ -107,28 +107,28 @@ void
libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, const char *psz_filepath,
unsigned int i_width, unsigned int i_height, libvlc_exception_t *p_e )
{
vout_thread_t *p_vout = GetVout( p_mi, p_e );
input_thread_t *p_input_thread;
/* GetVout will raise the exception for us */
if( !p_vout ) return;
vout_thread_t *p_vout;
/* The filepath must be not NULL */
if( !psz_filepath )
{
libvlc_exception_raise( p_e, "filepath is null" );
return;
}
var_SetInteger( p_vout, "snapshot-width", i_width );
var_SetInteger( p_vout, "snapshot-height", i_height );
p_input_thread = p_mi->p_input_thread;
/* We must have an input */
if( !p_mi->p_input_thread )
{
libvlc_exception_raise( p_e, "Input does not exist" );
return;
}
/* GetVout will raise the exception for us */
p_vout = GetVout( p_mi, p_e );
if( !p_vout ) return;
var_SetInteger( p_vout, "snapshot-width", i_width );
var_SetInteger( p_vout, "snapshot-height", i_height );
var_SetString( p_vout, "snapshot-path", psz_filepath );
var_SetString( p_vout, "snapshot-format", "png" );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment