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: 091c12e1f5 ("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>
This commit is contained in:
Wei Yongjun 2019-07-05 08:16:37 +00:00 committed by Mark Brown
parent 1fe08602d1
commit b90bab3b1b
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 2 additions and 2 deletions

View File

@ -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 */