]> git.alsa-project.org Git - alsa-lib.git/commitdiff
conf: fix possible memory leak in config_file_open() - error path
authorJaroslav Kysela <perex@perex.cz>
Tue, 9 Dec 2025 17:39:52 +0000 (18:39 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 9 Dec 2025 17:40:34 +0000 (18:40 +0100)
Fixes: a6238053 ("conf: merge card specific contents per file (whole) after parsing")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/conf.c

index b1ec9b382d666eb6b8c82b10283c8c69717307c2..d90f6dc35d3b13c597ea1b1f0dac98c291b848d7 100644 (file)
@@ -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);