Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932283AbcLLJhk (ORCPT ); Mon, 12 Dec 2016 04:37:40 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:58725 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752986AbcLLJhi (ORCPT ); Mon, 12 Dec 2016 04:37:38 -0500 From: Laurent Pinchart To: Santosh Kumar Singh Cc: Mauro Carvalho Chehab , Hans Verkuil , PJunghak Sung , Niklas =?ISO-8859-1?Q?S=F6derlund?= , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] vim2m: Clean up file handle in open() error path. Date: Mon, 12 Dec 2016 11:38:08 +0200 Message-ID: <4539600.dorPRmcVo7@avalon> User-Agent: KMail/4.14.10 (Linux/4.8.6-gentoo; KDE/4.14.24; x86_64; ; ) In-Reply-To: <1481131419-2921-1-git-send-email-kumar.san1093@gmail.com> References: <1481131419-2921-1-git-send-email-kumar.san1093@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1002 Lines: 40 Hi Santosh, Thank you for the patch. On Wednesday 07 Dec 2016 22:53:39 Santosh Kumar Singh wrote: > Fix to avoid possible memory leak and exit file handle > in error paths. > > Signed-off-by: Santosh Kumar Singh > --- > drivers/media/platform/vim2m.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c > index a98f679..9fd24b8 100644 > --- a/drivers/media/platform/vim2m.c > +++ b/drivers/media/platform/vim2m.c > @@ -907,6 +907,7 @@ static int vim2m_open(struct file *file) > if (hdl->error) { > rc = hdl->error; > v4l2_ctrl_handler_free(hdl); > + kfree(ctx); > goto open_unlock; > } > ctx->fh.ctrl_handler = hdl; > @@ -929,6 +930,7 @@ static int vim2m_open(struct file *file) > > v4l2_ctrl_handler_free(hdl); > kfree(ctx); > + v4l2_fh_exit(&ctx->fh); Don't you notice something wrong in those last two lines ? > goto open_unlock; > } -- Regards, Laurent Pinchart