alsa/0033-PCM-Fix-memory-leak-for-pcm-empty-and-asym-plugins.patch
Takashi Iwai 7a3b45a028 Accepting request 141190 from home:tiwai:branches:multimedia:libs
- backport fixes from upstream tree:
  0031-pcm-support-for-audio-timestamps.patch
  0032-pcm-fix-64-bit-SNDRV_PCM_IOCTL_STATUS-ABI-breakage.patch
  0033-PCM-Fix-memory-leak-for-pcm-empty-and-asym-plugins.patch
  0034-Reduce-compilation-warnings.patch
  0035-PCM-Avoid-busy-loop-in-snd_pcm_write_areas-with-rate.patch

OBS-URL: https://build.opensuse.org/request/show/141190
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=115
2012-11-13 16:37:14 +00:00

35 lines
1.0 KiB
Diff

From edcd677bf2065c560ef578940bab8f0aacddf0e6 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 30 Oct 2012 11:43:07 +0100
Subject: [PATCH 33/35] PCM: Fix memory leak for pcm empty and asym plugins
The init-only plugins do not have own pcm handle, so free the references
to open function immediately after open.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/pcm/pcm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 5880057..359d295 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -2171,7 +2171,12 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
if (open_func) {
err = open_func(pcmp, name, pcm_root, pcm_conf, stream, mode);
if (err >= 0) {
- (*pcmp)->open_func = open_func;
+ if ((*pcmp)->open_func) {
+ /* only init plugin (like empty, asym) */
+ snd_dlobj_cache_put(open_func);
+ } else {
+ (*pcmp)->open_func = open_func;
+ }
err = 0;
} else {
snd_dlobj_cache_put(open_func);
--
1.8.0