Skip to contentSkip to conversation

confmisc: fix memory leak in snd_func_concat

PATCH Applied Alex Henrie 2 participants 2 messages Dec 28, 2020 – Dec 29, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 confmisc: fix memory leak in snd_func_concat

---
 src/confmisc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
src/confmisc.c +1 -2
index eb8218c1..3ce95c7a 100644
@@ -419,7 +419,6 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
 				tmp = realloc(res, len + len1 + 1);
 				if (tmp == NULL) {
 					free(ptr);
-					free(res);
 					err = -ENOMEM;
 					goto __error;
 				}
@@ -440,8 +439,8 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
 	err = snd_config_get_id(src, &id);
 	if (err >= 0)
 		err = snd_config_imake_string(dst, id, res);
-	free(res);
       __error:
+	free(res);
 	return err;
 }
 #ifndef DOC_HIDDEN
Signature · 1 line
2.29.2