[vlc-devel] [PATCH 2/2] DirectSound: avoid double call to release function
Rémi Denis-Courmont
remi at remlab.net
Fri Feb 28 17:22:55 CET 2014
Le vendredi 28 février 2014, 15:55:29 Felix Abecassis a écrit :
> If Start() failed, IDirectSound_Release() was called twice. Use safer
> function Stop() instead.
> ---
> modules/audio_output/directsound.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/modules/audio_output/directsound.c
> b/modules/audio_output/directsound.c index b2a9ca6..d984015 100644
> --- a/modules/audio_output/directsound.c
> +++ b/modules/audio_output/directsound.c
> @@ -772,10 +772,7 @@ static HRESULT StreamStart( aout_stream_t *s,
>
> hr = Start( VLC_OBJECT(s), sys, fmt );
> if( FAILED(hr) )
> - {
> - IDirectSound_Release( sys->p_dsobject );
> goto error;
> - }
>
> s->sys = sys;
> s->time_get = StreamTimeGet;
> @@ -784,6 +781,7 @@ static HRESULT StreamStart( aout_stream_t *s,
> s->flush = StreamFlush;
> return S_OK;
> error:
> + Stop( sys );
Why? Start() already calls Stop() on error, and the other error path does not
need Stop() anyway.
> free( sys );
> return hr;
> }
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list