summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Vroon <chainsaw@gentoo.org>2010-02-12 16:10:21 +0000
committerTony Vroon <chainsaw@gentoo.org>2010-02-12 16:10:21 +0000
commit400f682fe318b1ac7cb388813d47d6b11713dec1 (patch)
treed120be3619201177387690a2fd972ef0159afe4a /media-libs/alsa-lib/files
parentDescribe --close option in man page thanks to Christopher Head (bug #252227). (diff)
downloadgentoo-2-400f682fe318b1ac7cb388813d47d6b11713dec1.tar.gz
gentoo-2-400f682fe318b1ac7cb388813d47d6b11713dec1.tar.bz2
gentoo-2-400f682fe318b1ac7cb388813d47d6b11713dec1.zip
Apply patch from Daniel T Chen (Ubuntu) to avoid a file-descriptor leak. It can be triggered by PulseAudio. With thanks to James Brown for identifying the required patch. Closes bug #304629.
(Portage version: 2.1.7.17/cvs/Linux x86_64)
Diffstat (limited to 'media-libs/alsa-lib/files')
-rw-r--r--media-libs/alsa-lib/files/alsa-lib-1.0.22-fd-leak.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/media-libs/alsa-lib/files/alsa-lib-1.0.22-fd-leak.patch b/media-libs/alsa-lib/files/alsa-lib-1.0.22-fd-leak.patch
new file mode 100644
index 000000000000..e7229cb9e0af
--- /dev/null
+++ b/media-libs/alsa-lib/files/alsa-lib-1.0.22-fd-leak.patch
@@ -0,0 +1,60 @@
+commit a256766c10c52cb6667de8a65f5cbb332fad4cc7
+Author: Jaroslav Kysela <perex@perex.cz>
+Date: Mon Dec 21 09:09:42 2009 +0100
+
+ pcm: Close event timer in pcm_hw plugin
+
+ Dan McCombs discovered that snd_pcm_close() invocations are not leading
+ to associated timers being closed, which results in successively more
+ timers being created but not freed.
+
+ Original patch from Daniel T Chen <crimsun@ubuntu.com>.
+
+ BugLink: https://bugs.launchpad.net/bugs/451893
+
+ Signed-off-by: Jaroslav Kysela <perex@perex.cz>
+
+diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
+index 2095b01..b557912 100644
+--- a/src/pcm/pcm_hw.c
++++ b/src/pcm/pcm_hw.c
+@@ -338,18 +338,6 @@ static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+ return 0;
+ }
+
+-static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
+-{
+- snd_pcm_hw_t *hw = pcm->private_data;
+- int fd = hw->fd, err;
+- if (ioctl(fd, SNDRV_PCM_IOCTL_HW_FREE) < 0) {
+- err = -errno;
+- SYSMSG("SNDRV_PCM_IOCTL_HW_FREE failed");
+- return err;
+- }
+- return 0;
+-}
+-
+ static void snd_pcm_hw_close_timer(snd_pcm_hw_t *hw)
+ {
+ if (hw->period_timer) {
+@@ -421,6 +409,20 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
+ } else {
+ snd_pcm_hw_close_timer(hw);
+ pcm->fast_ops = &snd_pcm_hw_fast_ops;
++ hw->period_event = 0;
++ }
++ return 0;
++}
++
++static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
++{
++ snd_pcm_hw_t *hw = pcm->private_data;
++ int fd = hw->fd, err;
++ snd_pcm_hw_change_timer(pcm, 0);
++ if (ioctl(fd, SNDRV_PCM_IOCTL_HW_FREE) < 0) {
++ err = -errno;
++ SYSMSG("SNDRV_PCM_IOCTL_HW_FREE failed");
++ return err;
+ }
+ return 0;
+ }