[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>
This commit is contained in:
Laurent Pinchart 2012-07-18 10:58:18 -03:00 committed by Mauro Carvalho Chehab
parent 4bbc6d52e6
commit edff996eb9

View file

@ -1098,18 +1098,17 @@ static int ov772x_probe(struct i2c_client *client,
V4L2_CID_BAND_STOP_FILTER, 0, 256, 1, 0); V4L2_CID_BAND_STOP_FILTER, 0, 256, 1, 0);
priv->subdev.ctrl_handler = &priv->hdl; priv->subdev.ctrl_handler = &priv->hdl;
if (priv->hdl.error) { if (priv->hdl.error) {
int err = priv->hdl.error; ret = priv->hdl.error;
goto done;
kfree(priv);
return err;
} }
ret = ov772x_video_probe(client); ret = ov772x_video_probe(client);
done:
if (ret) { if (ret) {
v4l2_ctrl_handler_free(&priv->hdl); v4l2_ctrl_handler_free(&priv->hdl);
kfree(priv); kfree(priv);
} }
return ret; return ret;
} }