diff --git a/modules/audio_output/directx.c b/modules/audio_output/directx.c index 6a69b04a40eede0a2624d2abae1b3f76bf7f7d4e..4afa919664ffefd47944025db1a78324ae76b571 100644 --- a/modules/audio_output/directx.c +++ b/modules/audio_output/directx.c @@ -92,7 +92,6 @@ struct aout_sys_t *****************************************************************************/ static int OpenAudio ( vlc_object_t * ); static void CloseAudio ( vlc_object_t * ); -static void CloseAudioCommon ( vlc_object_t * ); static void Play ( audio_output_t *, block_t * ); /* local functions */ @@ -278,8 +277,7 @@ static int OpenAudio( vlc_object_t *p_this ) != VLC_SUCCESS ) { msg_Err( p_aout, "cannot open directx audio device" ); - free( p_aout->sys ); - return VLC_EGENERIC; + goto error; } /* Calculate the frame size in bytes */ @@ -303,8 +301,8 @@ static int OpenAudio( vlc_object_t *p_this ) msg_Err( p_aout, "cannot create DirectSoundThread" ); CloseHandle( p_aout->sys->notif.event ); p_aout->sys->notif.event = NULL; - CloseAudio( VLC_OBJECT(p_aout) ); - return VLC_EGENERIC; + aout_PacketDestroy( p_aout ); + goto error; } p_aout->pf_play = Play; @@ -314,7 +312,7 @@ static int OpenAudio( vlc_object_t *p_this ) return VLC_SUCCESS; error: - CloseAudioCommon( VLC_OBJECT(p_aout) ); + CloseAudio( VLC_OBJECT(p_aout) ); return VLC_EGENERIC; } @@ -576,13 +574,6 @@ static void Play( audio_output_t *p_aout, block_t *p_buffer ) * CloseAudio: close the audio device *****************************************************************************/ static void CloseAudio( vlc_object_t *p_this ) -{ - audio_output_t * p_aout = (audio_output_t *)p_this; - aout_PacketDestroy( p_aout ); - CloseAudioCommon( p_this ); -} - -static void CloseAudioCommon( vlc_object_t *p_this ) { audio_output_t * p_aout = (audio_output_t *)p_this; aout_sys_t *p_sys = p_aout->sys; @@ -599,6 +590,7 @@ static void CloseAudioCommon( vlc_object_t *p_this ) vlc_join( p_sys->notif.thread, NULL ); CloseHandle( p_sys->notif.event ); + aout_PacketDestroy( p_aout ); } /* release the secondary buffer */ @@ -610,8 +602,6 @@ static void CloseAudioCommon( vlc_object_t *p_this ) /* free DSOUND.DLL */ if( p_sys->hdsound_dll ) FreeLibrary( p_sys->hdsound_dll ); - aout_PacketDestroy( p_aout ); - free( p_aout->sys->p_device_guid ); free( p_sys ); }