summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2019-07-05 11:16:37 +0300
committerMark Brown <broonie@kernel.org>2019-07-05 19:58:51 +0300
commitb90bab3b1b1b6c56dd6f9d5c960932239f36f6d3 (patch)
tree394ad5edeffcaec3b36c08b1a2f6384d6190d534 /sound
parent1fe08602d1179e7bfb2e805b22e8f57f4916c51e (diff)
downloadlinux-b90bab3b1b1b6c56dd6f9d5c960932239f36f6d3.tar.xz
ASoC: SOF: debug: fix possible memory leak in sof_dfsentry_write()
'string' is malloced in sof_dfsentry_write() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Fixes: 091c12e1f50c ("ASoC: SOF: debug: add new debugfs entries for IPC flood test") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20190705081637.157169-1-weiyongjun1@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/sof/debug.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c
index 54bb53bfc81b..2388477a965e 100644
--- a/sound/soc/sof/debug.c
+++ b/sound/soc/sof/debug.c
@@ -162,7 +162,7 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
else
ret = kstrtoul(string, 0, &ipc_count);
if (ret < 0)
- return ret;
+ goto out;
/* limit max duration/ipc count for flood test */
if (flood_duration_test) {
@@ -191,7 +191,7 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
"error: debugfs write failed to resume %d\n",
ret);
pm_runtime_put_noidle(sdev->dev);
- return ret;
+ goto out;
}
/* flood test */