fix memory leak when executing cset commands. snd_ctl_elem's are allocated, but never free'ed
PATCH 1/1 fix memory leak when executing cset commands. snd_ctl_elem's are allocated, but never free'ed
From: Baek Chang <[email protected]>
--- src/ucm/main.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
src/ucm/main.c +10 -1
@@ -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; }
Signature · 1 line
1.6.0.4
At Tue, 3 May 2011 10:52:34 -0700,
Quoted 2 lines · [email protected] wrote:
From: Baek Chang <[email protected]>
Applied now. Thanks.
Takashi
Quoted 37 lines
--- src/ucm/main.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)src/ucm/main.c +10
-1@@ -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; }Signature · 1 line
1.6.0.4