]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsactl: fix possible memory leak for dump-cfg
authorJaroslav Kysela <perex@perex.cz>
Wed, 10 Mar 2021 17:12:09 +0000 (18:12 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 10 Mar 2021 17:13:16 +0000 (18:13 +0100)
Also remove extra snd_config_update_free_global() call for dump-state.
There's a global call in the main() function.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsactl/alsactl.c

index 446365aedfd6c71ae53f11bb8296b0959f23507f..cc984e9bae8d239d7c02f6c3df56f22b542a46f9 100644 (file)
@@ -179,7 +179,6 @@ static int dump_state(const char *file)
                return err;
        err = dump_config_tree(top);
        snd_config_delete(top);
-       snd_config_update_free_global();
        return err;
 }
 
@@ -192,7 +191,9 @@ static int dump_configuration(void)
        if (err < 0)
                return err;
        /* expand cards.* tree */
-       snd_config_search_definition(top, "cards", "dummy", &cfg2);
+       err = snd_config_search_definition(top, "cards", "_dummy_", &cfg2);
+       if (err >= 0)
+               snd_config_delete(cfg2);
        err = dump_config_tree(top);
        snd_config_unref(top);
        return err;