diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-03-11 17:23:15 +0100 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-03-12 19:42:06 +0100 |
commit | f4b828128ab64fd9dc5eec9525b38fbfeafa5c0e (patch) | |
tree | 2128f939d05d01fd78b324c5ab24a6245b25e4f3 /sound/soc/codecs/wm_adsp.c | |
parent | Linux 3.9-rc2 (diff) | |
download | linux-f4b828128ab64fd9dc5eec9525b38fbfeafa5c0e.tar.xz linux-f4b828128ab64fd9dc5eec9525b38fbfeafa5c0e.zip |
ASoC: wm_adsp: fix possible memory leak in wm_adsp_load_coeff()
'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>
Diffstat (limited to 'sound/soc/codecs/wm_adsp.c')
-rw-r--r-- | sound/soc/codecs/wm_adsp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index f3f7e75f8628..9af1bddc4c62 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -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", @@ -865,7 +866,7 @@ out_fw: wm_adsp_buf_free(&buf_list); out: kfree(file); - return 0; + return ret; } int wm_adsp1_init(struct wm_adsp *adsp) |