Skip to content

Commit

Permalink
ASoC: wm_adsp: fix possible memory leak in wm_adsp_load_coeff()
Browse files Browse the repository at this point in the history
'file' is malloced in wm_adsp_load_coeff() and should be freed
before leaving from the error handling cases, otherwise it will cause
memory leak.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Wei Yongjun authored and Mark Brown committed Mar 12, 2013
1 parent f6161aa commit f4b8281
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm_adsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
&buf_list);
if (!buf) {
adsp_err(dsp, "Out of memory\n");
return -ENOMEM;
ret = -ENOMEM;
goto out_fw;
}

adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n",
Expand Down Expand Up @@ -865,7 +866,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
wm_adsp_buf_free(&buf_list);
out:
kfree(file);
return 0;
return ret;
}

int wm_adsp1_init(struct wm_adsp *adsp)
Expand Down

0 comments on commit f4b8281

Please sign in to comment.