mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: fdp1: Fix a memory leak bug
@ 2019-08-18  5:58 Wenwen Wang
  2019-08-21 11:39 ` Kieran Bingham
  0 siblings, 1 reply; 2+ messages in thread
From: Wenwen Wang @ 2019-08-18  5:58 UTC (permalink / raw)
  To: Wenwen Wang
  Cc: Kieran Bingham, Mauro Carvalho Chehab,
	open list:MEDIA DRIVERS FOR RENESAS - FDP1,
	open list:MEDIA DRIVERS FOR RENESAS - FDP1, open list

In fdp1_open(), 'ctx' is allocated through kzalloc(). However, it is not
deallocated if v4l2_ctrl_new_std() fails, leading to a memory leak bug. To
fix this issue, free 'ctx' before going to the 'done' label.

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
---
 drivers/media/platform/rcar_fdp1.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c
index 43aae9b..9e4b330 100644
--- a/drivers/media/platform/rcar_fdp1.c
+++ b/drivers/media/platform/rcar_fdp1.c
@@ -2122,6 +2122,7 @@ static int fdp1_open(struct file *file)
 	if (ctx->hdl.error) {
 		ret = ctx->hdl.error;
 		v4l2_ctrl_handler_free(&ctx->hdl);
+		kfree(ctx);
 		goto done;
 	}
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-21 11:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-18  5:58 [PATCH] media: fdp1: Fix a memory leak bug Wenwen Wang
2019-08-21 11:39 ` Kieran Bingham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®