Skip to contentSkip to conversation

vim2m: Clean up file handle in open() error path.

PATCH New Santosh Kumar Singh 1 participant 1 message Dec 19, 2016 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 vim2m: Clean up file handle in open() error path.

Fix to avoid possible memory leak and exit file handle in error paths.

---
 drivers/media/platform/vim2m.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/platform/vim2m.c +2 -0
index a98f679..9fd24b8 100644
@@ -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);
+		v4l2_fh_exit(&ctx->fh);
 		kfree(ctx);
 		goto open_unlock;
 	}
 
Signature · 1 line
1.9.1