vlc/vlc-3.0 | branch: master | Thomas Guillem <tho...@gllm.fr> | Mon Sep 9 17:37:30 2019 +0200| [a42f3ec9a965c39e0d9056581455887add3a3fa0] | committer: Thomas Guillem
directsound: fix uninitialized var usage on error path When directsound was used via mmdevice, a failing CreateDSBufferPCM() triggered an invalid vlc_cancel call on the uninitialized thread variable. CID 374810d1-d1be-4a63-a5af-5349cb6607d1 (cherry picked from commit ff5142ffbd168b6bf9640566b03be6defe146fda) Signed-off-by: Thomas Guillem <tho...@gllm.fr> > http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=a42f3ec9a965c39e0d9056581455887add3a3fa0 --- modules/audio_output/directsound.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c index 4aa9d28d53..048d107bb1 100644 --- a/modules/audio_output/directsound.c +++ b/modules/audio_output/directsound.c @@ -803,19 +803,8 @@ static HRESULT Start( vlc_object_t *obj, aout_stream_sys_t *sys, if( ret != ENOMEM ) msg_Err( obj, "Couldn't start eraser thread" ); - vlc_cond_destroy(&sys->cond); - vlc_mutex_destroy(&sys->lock); - - if( sys->p_notify != NULL ) - { - IDirectSoundNotify_Release( sys->p_notify ); - sys->p_notify = NULL; - } - IDirectSoundBuffer_Release( sys->p_dsbuffer ); - sys->p_dsbuffer = NULL; - IDirectSound_Release( sys->p_dsobject ); - sys->p_dsobject = NULL; - return ret; + hr = E_FAIL; + goto error; } fmt.channel_type = AUDIO_CHANNEL_TYPE_BITMAP; @@ -829,7 +818,21 @@ static HRESULT Start( vlc_object_t *obj, aout_stream_sys_t *sys, return DS_OK; error: - Stop( sys ); + vlc_cond_destroy(&sys->cond); + vlc_mutex_destroy(&sys->lock); + + if( sys->p_notify != NULL ) + { + IDirectSoundNotify_Release( sys->p_notify ); + sys->p_notify = NULL; + } + if( sys->p_dsbuffer != NULL ) + { + IDirectSoundBuffer_Release( sys->p_dsbuffer ); + sys->p_dsbuffer = NULL; + } + IDirectSound_Release( sys->p_dsobject ); + sys->p_dsobject = NULL; return hr; } _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits