Commit b90bab3b authored by Wei Yongjun's avatar Wei Yongjun Committed by Mark Brown

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: 091c12e1 ("ASoC: SOF: debug: add new debugfs entries for IPC flood test")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20190705081637.157169-1-weiyongjun1@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1fe08602
...@@ -162,7 +162,7 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer, ...@@ -162,7 +162,7 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
else else
ret = kstrtoul(string, 0, &ipc_count); ret = kstrtoul(string, 0, &ipc_count);
if (ret < 0) if (ret < 0)
return ret; goto out;
/* limit max duration/ipc count for flood test */ /* limit max duration/ipc count for flood test */
if (flood_duration_test) { if (flood_duration_test) {
...@@ -191,7 +191,7 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer, ...@@ -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", "error: debugfs write failed to resume %d\n",
ret); ret);
pm_runtime_put_noidle(sdev->dev); pm_runtime_put_noidle(sdev->dev);
return ret; goto out;
} }
/* flood test */ /* flood test */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment