changeset 29436:4537ed655f0b

Do not leak the mixer handle if setting of a volume fails.
author cladisch
date Thu, 06 Aug 2009 09:43:10 +0000
parents 9b2014f09534
children d401b1eefcad
files libao2/ao_alsa.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_alsa.c	Wed Aug 05 23:16:21 2009 +0000
+++ b/libao2/ao_alsa.c	Thu Aug 06 09:43:10 2009 +0000
@@ -209,6 +209,7 @@
 	if ((err = snd_mixer_selem_set_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT, set_vol)) < 0) {
 	  mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingLeftChannel,
 		 snd_strerror(err));
+	  snd_mixer_close(handle);
 	  return CONTROL_ERROR;
 	}
 	mp_msg(MSGT_AO,MSGL_DBG2,"left=%li, ", set_vol);
@@ -218,6 +219,7 @@
 	if ((err = snd_mixer_selem_set_playback_volume(elem, SND_MIXER_SCHN_FRONT_RIGHT, set_vol)) < 0) {
 	  mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingRightChannel,
 		 snd_strerror(err));
+	  snd_mixer_close(handle);
 	  return CONTROL_ERROR;
 	}
 	mp_msg(MSGT_AO,MSGL_DBG2,"right=%li, pmin=%li, pmax=%li, mult=%f\n",