Commit 4f292d82 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix mixer leak (and crash at exit) when audio output fails

parent a71d3315
...@@ -97,7 +97,7 @@ int aout_DecNew( audio_output_t *p_aout, ...@@ -97,7 +97,7 @@ int aout_DecNew( audio_output_t *p_aout,
aout_Shutdown (p_aout); aout_Shutdown (p_aout);
} }
#endif #endif
int ret = -1; int ret = 0;
/* TODO: reduce lock scope depending on decoder's real need */ /* TODO: reduce lock scope depending on decoder's real need */
aout_lock( p_aout ); aout_lock( p_aout );
...@@ -110,7 +110,10 @@ int aout_DecNew( audio_output_t *p_aout, ...@@ -110,7 +110,10 @@ int aout_DecNew( audio_output_t *p_aout,
owner->input_format = *p_format; owner->input_format = *p_format;
vlc_atomic_set (&owner->restart, 0); vlc_atomic_set (&owner->restart, 0);
if( aout_OutputNew( p_aout, p_format ) < 0 ) if( aout_OutputNew( p_aout, p_format ) < 0 )
{
ret = -1;
goto error; goto error;
}
/* Allocate a software mixer */ /* Allocate a software mixer */
assert (owner->volume.mixer == NULL); assert (owner->volume.mixer == NULL);
...@@ -129,9 +132,15 @@ int aout_DecNew( audio_output_t *p_aout, ...@@ -129,9 +132,15 @@ int aout_DecNew( audio_output_t *p_aout,
owner->input = aout_InputNew (p_aout, p_format, &owner->mixer_format, owner->input = aout_InputNew (p_aout, p_format, &owner->mixer_format,
p_request_vout); p_request_vout);
if (owner->input == NULL) if (owner->input == NULL)
{
struct audio_mixer *mixer = owner->volume.mixer;
owner->volume.mixer = NULL;
aout_OutputDelete (p_aout); aout_OutputDelete (p_aout);
else aout_unlock (p_aout);
ret = 0; aout_MixerDelete (mixer);
return -1;
}
error: error:
aout_unlock( p_aout ); aout_unlock( p_aout );
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment