diff mbox series

[v2] confmisc: fix memory leak in snd_func_concat

Message ID 20201228014315.39991-1-alexhenrie24@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v2] confmisc: fix memory leak in snd_func_concat | expand

Commit Message

Alex Henrie Dec. 28, 2020, 1:43 a.m. UTC
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
 src/confmisc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Takashi Iwai Dec. 29, 2020, 8:23 a.m. UTC | #1
On Mon, 28 Dec 2020 02:43:15 +0100,
Alex Henrie wrote:
> 
> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>

Thanks, applied.


Takashi
diff mbox series

Patch

diff --git a/src/confmisc.c b/src/confmisc.c
index eb8218c1..3ce95c7a 100644
--- a/src/confmisc.c
+++ b/src/confmisc.c
@@ -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