summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2021-06-29 19:31:28 +0200
committerJaroslav Kysela <perex@perex.cz>2021-06-29 19:31:35 +0200
commit23a191a82c693456e61431ab699cddc1e5782a26 (patch)
treeb4ccb87835a77ceb96c91fad56d4226e42f904f7
parente47c11822d6b459a9b3704b3ee6a4a5c9a1b85be (diff)
downloadalsa-lib-23a191a82c693456e61431ab699cddc1e5782a26.tar.gz
control: remap - assign right name to the child handle for no-op (2nd case)
Fixes: https://github.com/alsa-project/alsa-utils/issues/100 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--src/control/control_remap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/control/control_remap.c b/src/control/control_remap.c
index 81524014..4914f960 100644
--- a/src/control/control_remap.c
+++ b/src/control/control_remap.c
@@ -1154,6 +1154,10 @@ int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *rema
snd_ctl_t *ctl;
int result, err;
+ /* no-op, remove the plugin */
+ if (!remap && !map)
+ goto _noop;
+
priv = calloc(1, sizeof(*priv));
if (priv == NULL)
return -ENOMEM;
@@ -1173,6 +1177,7 @@ int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *rema
/* no-op check, remove the plugin */
if (priv->map_items == 0 && priv->remap_items == 0) {
remap_free(priv);
+ _noop:
free(child->name);
child->name = name ? strdup(name) : NULL;
if (name && !child->name)
@@ -1316,11 +1321,6 @@ int _snd_ctl_remap_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd
err = _snd_ctl_open_child(&cctl, root, child, mode, conf);
if (err < 0)
return err;
- /* no-op, remove the plugin */
- if (!remap && !map) {
- *handlep = cctl;
- return 0;
- }
err = snd_ctl_remap_open(handlep, name, remap, map, cctl, mode);
if (err < 0)
snd_ctl_close(cctl);