From: Jaroslav Kysela Date: Tue, 9 Dec 2025 17:39:52 +0000 (+0100) Subject: conf: fix possible memory leak in config_file_open() - error path X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=2f59398c83b8065fb9ff58939df3a9187746068e;p=alsa-lib.git conf: fix possible memory leak in config_file_open() - error path Fixes: a6238053 ("conf: merge card specific contents per file (whole) after parsing") Signed-off-by: Jaroslav Kysela --- diff --git a/src/conf.c b/src/conf.c index b1ec9b38..d90f6dc3 100644 --- a/src/conf.c +++ b/src/conf.c @@ -4130,8 +4130,11 @@ static int config_file_open(snd_config_t *root, const char *filename, int merge) err = snd_config_top(&top); if (err >= 0) { err = snd_config_load(top, in); - if (err >= 0) + if (err >= 0) { err = snd_config_merge(root, top, 1); + if (err < 0) + snd_config_delete(top); + } } } snd_input_close(in);