Takashi Iwai
00857544be
- Backport upstream fixes for plug-in API rewind, a possible memory leak in direct plugins, chmap buffer overflow and some segfaults: 0003-Allow-specifying-the-max-number-of-cards.patch 0004-pcm_hw-Remove-unused-fields-in-struct.patch 0005-pcm_plugin-Fix-return-value-of-snd_pcm_rewind.patch 0006-pcm_direct-fix-the-memory-leak-when-parsing-the-slav.patch 0007-chmap-Always-succeed-setting-the-map-to-what-it-alre.patch 0008-pcm_hw-Fix-buffer-overflow-in-chmap.patch 0009-pcm_direct-fix-SEGFAULT-when-getgrnam_r-returns-0-an.patch OBS-URL: https://build.opensuse.org/request/show/179267 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=135
66 lines
2.1 KiB
Diff
66 lines
2.1 KiB
Diff
From ca487c9511c1500184023dfea803a5e785d725e2 Mon Sep 17 00:00:00 2001
|
|
From: Jaroslav Kysela <perex@perex.cz>
|
|
Date: Tue, 4 Jun 2013 15:58:34 +0200
|
|
Subject: [PATCH] pcm_direct: fix the memory leak when parsing the slave
|
|
definitions
|
|
|
|
Reported-by: <bolsunov@telum.ru>
|
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
---
|
|
src/pcm/pcm_direct.c | 32 +++++++++++++++++++++++---------
|
|
1 file changed, 23 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c
|
|
index 38c6c66..101d3c8 100644
|
|
--- a/src/pcm/pcm_direct.c
|
|
+++ b/src/pcm/pcm_direct.c
|
|
@@ -1453,7 +1453,7 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
|
|
int hop)
|
|
{
|
|
snd_config_iterator_t i, next;
|
|
- snd_config_t *pcm_conf;
|
|
+ snd_config_t *pcm_conf, *pcm_conf2;
|
|
int err;
|
|
long card = 0, device = 0, subdevice = 0;
|
|
const char *str;
|
|
@@ -1484,14 +1484,28 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
|
|
}
|
|
#endif
|
|
|
|
- if (snd_config_search(sconf, "slave", &pcm_conf) >= 0 &&
|
|
- (snd_config_search(pcm_conf, "pcm", &pcm_conf) >= 0 ||
|
|
- (snd_config_get_string(pcm_conf, &str) >= 0 &&
|
|
- snd_config_search_definition(root, "pcm_slave", str, &pcm_conf) >= 0 &&
|
|
- snd_config_search(pcm_conf, "pcm", &pcm_conf) >= 0)))
|
|
- return _snd_pcm_direct_get_slave_ipc_offset(root, pcm_conf,
|
|
- direction,
|
|
- hop + 1);
|
|
+ if (snd_config_search(sconf, "slave", &pcm_conf) >= 0) {
|
|
+ if (snd_config_search(pcm_conf, "pcm", &pcm_conf) >= 0) {
|
|
+ return _snd_pcm_direct_get_slave_ipc_offset(root,
|
|
+ pcm_conf,
|
|
+ direction,
|
|
+ hop + 1);
|
|
+ } else {
|
|
+ if (snd_config_get_string(pcm_conf, &str) >= 0 &&
|
|
+ snd_config_search_definition(root, "pcm_slave",
|
|
+ str, &pcm_conf) >= 0) {
|
|
+ if (snd_config_search(pcm_conf, "pcm",
|
|
+ &pcm_conf2) >= 0) {
|
|
+ err =
|
|
+ _snd_pcm_direct_get_slave_ipc_offset(
|
|
+ root, pcm_conf2, direction, hop + 1);
|
|
+ snd_config_delete(pcm_conf);
|
|
+ return err;
|
|
+ }
|
|
+ snd_config_delete(pcm_conf);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
|
|
snd_config_for_each(i, next, sconf) {
|
|
snd_config_t *n = snd_config_iterator_entry(i);
|
|
--
|
|
1.8.3
|
|
|