]> git.alsa-project.org Git - alsa-lib.git/commitdiff
ucm: libconfig parser - fix memory leaks
authorJaroslav Kysela <perex@perex.cz>
Tue, 18 May 2021 09:20:18 +0000 (11:20 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 18 May 2021 09:30:21 +0000 (11:30 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/ucm/parser.c

index 68b0ee6273776aceae74e9c6b5a9c7f4d6be0d61..c6687a4960beb1d6c635128f98a925168a4703e1 100644 (file)
@@ -457,7 +457,7 @@ static int parse_libconfig1(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
                                return err;
                        err = uc_mgr_substitute_tree(uc_mgr, cfg);
                        if (err < 0) {
-                               snd_config_delete(config);
+                               snd_config_delete(cfg);
                                return err;
                        }
                        err = snd_config_merge(uc_mgr->local_config, cfg, 1);
@@ -480,16 +480,12 @@ static int parse_libconfig1(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
        if (config) {
                if (substconfig) {
                        err = uc_mgr_substitute_tree(uc_mgr, config);
-                       if (err < 0) {
-                               snd_config_delete(config);
+                       if (err < 0)
                                return err;
-                       }
                }
                err = snd_config_merge(uc_mgr->local_config, config, 1);
-               if (err < 0) {
-                       snd_config_delete(config);
+               if (err < 0)
                        return err;
-               }
        }
 
        return 0;