From 7f5622c106afa457981669cac6c30ea50f547a7b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 10 Mar 2021 18:12:09 +0100 Subject: [PATCH] alsactl: fix possible memory leak for dump-cfg 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 --- alsactl/alsactl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c index 446365a..cc984e9 100644 --- a/alsactl/alsactl.c +++ b/alsactl/alsactl.c @@ -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;