[vlc-commits] Fix mixer leak (and crash at exit) when audio output fails
Rémi Denis-Courmont
git at videolan.org
Wed Mar 7 18:15:04 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Mar 7 19:07:57 2012 +0200| [cae81dcf902ded27ff7723859a19834c6bd43396] | committer: Rémi Denis-Courmont
Fix mixer leak (and crash at exit) when audio output fails
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cae81dcf902ded27ff7723859a19834c6bd43396
---
configure.ac | 4 ++--
src/audio_output/dec.c | 15 ++++++++++++---
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 62dc5fc..5f99552 100644
--- a/configure.ac
+++ b/configure.ac
@@ -966,8 +966,8 @@ AS_IF([test "${enable_optimizations}" != "no"], [
AS_IF([test "${ac_cv_c_fast_math}" = "no"], [VLC_RESTORE_FLAGS])
AH_BOTTOM([
#ifndef __FAST_MATH__
-# pragma STDC FENV_ACCESS off
-# pragma STDC FP_CONTRACT on
+# pragma STDC FENV_ACCESS OFF
+# pragma STDC FP_CONTRACT ON
#endif
])
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index 36749b0..156186a 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -97,7 +97,7 @@ int aout_DecNew( audio_output_t *p_aout,
aout_Shutdown (p_aout);
}
#endif
- int ret = -1;
+ int ret = 0;
/* TODO: reduce lock scope depending on decoder's real need */
aout_lock( p_aout );
@@ -110,7 +110,10 @@ int aout_DecNew( audio_output_t *p_aout,
owner->input_format = *p_format;
vlc_atomic_set (&owner->restart, 0);
if( aout_OutputNew( p_aout, p_format ) < 0 )
+ {
+ ret = -1;
goto error;
+ }
/* Allocate a software mixer */
assert (owner->volume.mixer == NULL);
@@ -129,9 +132,15 @@ int aout_DecNew( audio_output_t *p_aout,
owner->input = aout_InputNew (p_aout, p_format, &owner->mixer_format,
p_request_vout);
if (owner->input == NULL)
+ {
+ struct audio_mixer *mixer = owner->volume.mixer;
+
+ owner->volume.mixer = NULL;
aout_OutputDelete (p_aout);
- else
- ret = 0;
+ aout_unlock (p_aout);
+ aout_MixerDelete (mixer);
+ return -1;
+ }
error:
aout_unlock( p_aout );
return ret;
More information about the vlc-commits
mailing list