[vlc-devel] commit: Fix potential object leak ( test the conditions before doing anything). ( Rémi Duraffort )
git version control
git at videolan.org
Wed May 20 11:16:27 CEST 2009
vlc | branch: 1.0-bugfix | Rémi Duraffort <ivoire at videolan.org> | Wed May 20 11:15:43 2009 +0200| [5efbd6a16652f26fe0f30bbdd801877e7234f669] | committer: Rémi Duraffort
Fix potential object leak (test the conditions before doing anything).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5efbd6a16652f26fe0f30bbdd801877e7234f669
---
src/control/video.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/control/video.c b/src/control/video.c
index 7904aa2..cd36258 100644
--- a/src/control/video.c
+++ b/src/control/video.c
@@ -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" );
More information about the vlc-devel
mailing list