File 0004-conf-fix-possible-memory-leak-in-config_file_open-er.patch of Package alsa

From 2f59398c83b8065fb9ff58939df3a9187746068e Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 9 Dec 2025 18:39:52 +0100
Subject: [PATCH 4/7] 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 <perex@perex.cz>
---
 src/conf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/conf.c b/src/conf.c
index b1ec9b382d66..d90f6dc35d3b 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);
-- 
2.52.0

openSUSE Build Service is sponsored by