]> git.alsa-project.org Git - alsa-lib.git/commitdiff
conf: fix parse_array_def override code path master
authorJaroslav Kysela <perex@perex.cz>
Thu, 18 Sep 2025 09:00:47 +0000 (11:00 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 18 Sep 2025 09:00:47 +0000 (11:00 +0200)
The error may cause segmentation fault and incorrect behaviour.

Closes: https://github.com/alsa-project/alsa-lib/issues/477
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/conf.c

index 905c8f4d9f7efcf751f6e4597d4cb571e3eab7cc..a48e0db0853fc169746408ddefab47b35f0f32fb 100644 (file)
@@ -1268,13 +1268,13 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int s
        snd_config_t *n = NULL;
 
        if (!skip) {
-               snd_config_t *g;
                char static_id[12];
                while (1) {
                        snprintf(static_id, sizeof(static_id), "%i", *idx);
-                       if (_snd_config_search(parent, static_id, -1, &g) == 0) {
+                       if (_snd_config_search(parent, static_id, -1, &n) == 0) {
                                if (override) {
                                        snd_config_delete(n);
+                                       n = NULL;
                                } else {
                                        /* merge */
                                        (*idx)++;