[alsa-devel] [PATCH] ALSA: memory leak in alsaucm
Baek Chang
baeksan at ccrma.stanford.edu
Mon May 2 23:56:28 CEST 2011
First time sending a patch, please let me know if I am doing this
incorrectly.
alsaucm is leaking memory whenever execute_cset() is called.
bchang at LT74002R2XXG1:~/projects/alsa-lib-git/src/ucm$ git diff
diff --git a/src/ucm/main.c b/src/ucm/main.c
index 86f29e3..f8ceeeb 100644
--- a/src/ucm/main.c
+++ b/src/ucm/main.c
@@ -173,7 +173,8 @@ static int execute_cset(snd_ctl_t *ctl, char *cset)
pos = strrchr(cset, ' ');
if (pos == NULL) {
uc_error("undefined value for cset >%s<", cset);
- return -EINVAL;
+ err = -EINVAL;
+ goto __fail;
}
*pos = '\0';
err = snd_ctl_ascii_elem_id_parse(id, cset);
@@ -196,6 +197,14 @@ static int execute_cset(snd_ctl_t *ctl, char *cset)
err = 0;
__fail:
*pos = ' ';
+
+ if (id != NULL)
+ free(id);
+ if (value != NULL)
+ free(value);
+ if (info != NULL)
+ free(info);
+
return err;
}
Thanks
--
-baeksanchang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alsaucm.patch
Type: text/x-patch
Size: 648 bytes
Desc: not available
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20110502/2bf26a7f/attachment.patch
More information about the Alsa-devel
mailing list