From: Laurent Pinchart Date: Wed, 18 Jul 2012 13:58:18 +0000 (-0300) Subject: [media] ov772x: Fix memory leak in probe error path X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=edff996eb942ce5595e9b60a0e06586dcc41b19b;p=linux-beck.git [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 Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/i2c/soc_camera/ov772x.c b/drivers/media/i2c/soc_camera/ov772x.c index 641f6f43d7ee..0fede50dde4b 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, 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; }