Skip to content

Commit

Permalink
[media] ov772x: Fix memory leak in probe error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed Aug 15, 2012
1 parent 4bbc6d5 commit edff996
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/media/i2c/soc_camera/ov772x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1098,18 +1098,17 @@ static int ov772x_probe(struct i2c_client *client,
V4L2_CID_BAND_STOP_FILTER, 0, 256, 1, 0);
priv->subdev.ctrl_handler = &priv->hdl;
if (priv->hdl.error) {
int err = priv->hdl.error;

kfree(priv);
return err;
ret = priv->hdl.error;
goto done;
}

ret = ov772x_video_probe(client);

done:
if (ret) {
v4l2_ctrl_handler_free(&priv->hdl);
kfree(priv);
}

return ret;
}

Expand Down

0 comments on commit edff996

Please sign in to comment.