lkml.org 
[lkml]   [2019]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] media: staging: davinci: fix for memory leak
Date
In ipipe_g_config the allocated memory for params needs to be released
if either module_if->get or copy_to_user fails.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
index 52397ad0e3e2..3023691b53c0 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
@@ -1316,10 +1316,13 @@ static int ipipe_g_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg)

if (to && from && size) {
rval = module_if->get(ipipe, from);
- if (rval)
+ if (rval) {
+ kfree(params);
goto error;
+ }
if (copy_to_user((void __user *)to, from, size)) {
rval = -EFAULT;
+ kfree(params);
break;
}
}
--
2.17.1
\
 
 \ /
  Last update: 2019-09-18 01:03    [W:0.272 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site