aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-07-18 09:58:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-15 16:05:02 -0400
commitedff996eb942ce5595e9b60a0e06586dcc41b19b (patch)
tree3db011ebc7a99c04a1e94b722c9a393ba61ea3f6 /drivers/media
parent4bbc6d52e61a8a9c19fcc859c4acab89cb8cd4e5 (diff)
[media] ov772x: Fix memory leak in probe error path
The control handler isn't freed if its initialization fails. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/i2c/soc_camera/ov772x.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/media/i2c/soc_camera/ov772x.c b/drivers/media/i2c/soc_camera/ov772x.c
index 641f6f43d7e..0fede50dde4 100644
--- a/drivers/media/i2c/soc_camera/ov772x.c
+++ b/drivers/media/i2c/soc_camera/ov772x.c
@@ -1098,18 +1098,17 @@ static int ov772x_probe(struct i2c_client *client,
1098 V4L2_CID_BAND_STOP_FILTER, 0, 256, 1, 0); 1098 V4L2_CID_BAND_STOP_FILTER, 0, 256, 1, 0);
1099 priv->subdev.ctrl_handler = &priv->hdl; 1099 priv->subdev.ctrl_handler = &priv->hdl;
1100 if (priv->hdl.error) { 1100 if (priv->hdl.error) {
1101 int err = priv->hdl.error; 1101 ret = priv->hdl.error;
1102 1102 goto done;
1103 kfree(priv);
1104 return err;
1105 } 1103 }
1106 1104
1107 ret = ov772x_video_probe(client); 1105 ret = ov772x_video_probe(client);
1106
1107done:
1108 if (ret) { 1108 if (ret) {
1109 v4l2_ctrl_handler_free(&priv->hdl); 1109 v4l2_ctrl_handler_free(&priv->hdl);
1110 kfree(priv); 1110 kfree(priv);
1111 } 1111 }
1112
1113 return ret; 1112 return ret;
1114} 1113}
1115 1114