[vlc-devel] [PATCH 2/2] DirectSound: avoid double call to release function

Felix Abecassis felix.abecassis at gmail.com
Fri Feb 28 17:25:45 CET 2014


Yes, I know. But I think this is safer this way in case StreamStart changes.

2014-02-28 17:22 GMT+01:00 Rémi Denis-Courmont <remi at remlab.net>:
> 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/
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



-- 
Félix Abecassis
http://felix.abecassis.me



More information about the vlc-devel mailing list