diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2014-08-22 14:19:44 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2014-08-22 15:17:37 +0200 |
commit | 8e1f50d7433b9a6e52cb296943f53c3ce8189ea5 (patch) | |
tree | ead604fd4ce9da52cae2cec23f012b77384b31f5 | |
parent | ioat: Use time_before_jiffies() (diff) | |
download | linux-8e1f50d7433b9a6e52cb296943f53c3ce8189ea5.tar.xz linux-8e1f50d7433b9a6e52cb296943f53c3ce8189ea5.zip |
dmatest: prevent memory leakage on error path in thread
When we fail to allocate memory for thread->srcs or thread->dsts and src_cnt or
dst_cnt great than 1 we leak memory on error path. This patch fixes the issue.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/dma/dmatest.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index 05b6dea770a4..69616e2108fc 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -688,14 +688,14 @@ static int dmatest_func(void *data) runtime = ktime_us_delta(ktime_get(), ktime); ret = 0; +err_dstbuf: for (i = 0; thread->dsts[i]; i++) kfree(thread->dsts[i]); -err_dstbuf: kfree(thread->dsts); err_dsts: +err_srcbuf: for (i = 0; thread->srcs[i]; i++) kfree(thread->srcs[i]); -err_srcbuf: kfree(thread->srcs); err_srcs: kfree(pq_coefs); |