From: Jaroslav Kysela Date: Fri, 13 May 2022 14:19:48 +0000 (+0200) Subject: conf: fix memory leak in snd_config_substitute() for strings X-Git-Tag: v1.2.7~38 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=3e5a8943781d17361ffe79e03c23e76946fcd67f;p=alsa-lib.git conf: fix memory leak in snd_config_substitute() for strings When destination type is SND_CONFIG_TYPE_STRING, the old string must be freed. Signed-off-by: Jaroslav Kysela --- diff --git a/src/conf.c b/src/conf.c index 70f0e773..e7f9e78c 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1741,6 +1741,8 @@ int snd_config_substitute(snd_config_t *dst, snd_config_t *src) src->u.compound.fields.prev->next = &dst->u.compound.fields; } free(dst->id); + if (dst->type == SND_CONFIG_TYPE_STRING) + free(dst->u.string); dst->id = src->id; dst->type = src->type; dst->u = src->u;