diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-03-11 12:23:15 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-03-12 14:42:06 -0400 |
commit | f4b828128ab64fd9dc5eec9525b38fbfeafa5c0e (patch) | |
tree | 2128f939d05d01fd78b324c5ab24a6245b25e4f3 /sound/soc/codecs/wm_adsp.c | |
parent | f6161aa153581da4a3867a2d1a7caf4be19b6ec9 (diff) |
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) | |||
828 | &buf_list); | 828 | &buf_list); |
829 | if (!buf) { | 829 | if (!buf) { |
830 | adsp_err(dsp, "Out of memory\n"); | 830 | adsp_err(dsp, "Out of memory\n"); |
831 | return -ENOMEM; | 831 | ret = -ENOMEM; |
832 | goto out_fw; | ||
832 | } | 833 | } |
833 | 834 | ||
834 | adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n", | 835 | adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n", |
@@ -865,7 +866,7 @@ out_fw: | |||
865 | wm_adsp_buf_free(&buf_list); | 866 | wm_adsp_buf_free(&buf_list); |
866 | out: | 867 | out: |
867 | kfree(file); | 868 | kfree(file); |
868 | return 0; | 869 | return ret; |
869 | } | 870 | } |
870 | 871 | ||
871 | int wm_adsp1_init(struct wm_adsp *adsp) | 872 | int wm_adsp1_init(struct wm_adsp *adsp) |