From: Richard Hosking Date: Thu, 17 Apr 2008 15:33:14 +0000 (+0100) Subject: i_fd is not applicable for Alsa so don't try and close it if one of the Alsa routines... X-Git-Tag: 0.9.0-test0~1433 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=0f79e202ee068af55a689d2aa5b4f37988080063;p=vlc i_fd is not applicable for Alsa so don't try and close it if one of the Alsa routines fail. --- diff --git a/modules/access/v4l2/v4l2.c b/modules/access/v4l2/v4l2.c index ad1dfb6c38..3d3cf1ed4a 100644 --- a/modules/access/v4l2/v4l2.c +++ b/modules/access/v4l2/v4l2.c @@ -2259,7 +2259,6 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys, bool b_demux ) { char *psz_device = p_sys->psz_adev; - int i_fd = 0; p_sys->p_alsa_pcm = NULL; char* psz_alsa_device_name = NULL; snd_pcm_hw_params_t *p_hw_params = NULL; @@ -2426,18 +2425,15 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys, goto adev_fail; } - /* Return a fake handle so other tests work */ - i_fd = 1; - free( psz_alsa_device_name ); if( !p_sys->psz_adev ) p_sys->psz_adev = strdup( ALSA_DEFAULT ); - return i_fd; - adev_fail: + /* Return a fake handle so other tests work */ + return 1; - if( i_fd >= 0 ) close( i_fd ); + adev_fail: if( p_hw_params ) snd_pcm_hw_params_free( p_hw_params ); if( p_sys->p_alsa_pcm ) snd_pcm_close( p_sys->p_alsa_pcm );