Commit f61861fa authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] radio-isa: fix memory leak

If there is an error when creating controls the v4l2_ctrl_handler_free
function must be called.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ff27cda3
...@@ -274,23 +274,21 @@ int radio_isa_common_probe(struct radio_isa_card *isa, struct device *pdev, ...@@ -274,23 +274,21 @@ int radio_isa_common_probe(struct radio_isa_card *isa, struct device *pdev,
res = ops->s_stereo(isa, isa->stereo); res = ops->s_stereo(isa, isa->stereo);
if (res < 0) { if (res < 0) {
v4l2_err(v4l2_dev, "Could not setup card\n"); v4l2_err(v4l2_dev, "Could not setup card\n");
goto err_node_reg; goto err_hdl;
} }
res = video_register_device(&isa->vdev, VFL_TYPE_RADIO, radio_nr); res = video_register_device(&isa->vdev, VFL_TYPE_RADIO, radio_nr);
if (res < 0) { if (res < 0) {
v4l2_err(v4l2_dev, "Could not register device node\n"); v4l2_err(v4l2_dev, "Could not register device node\n");
goto err_node_reg; goto err_hdl;
} }
v4l2_info(v4l2_dev, "Initialized radio card %s on port 0x%03x\n", v4l2_info(v4l2_dev, "Initialized radio card %s on port 0x%03x\n",
drv->card, isa->io); drv->card, isa->io);
return 0; return 0;
err_node_reg:
v4l2_ctrl_handler_free(&isa->hdl);
err_hdl: err_hdl:
v4l2_device_unregister(&isa->v4l2_dev); v4l2_ctrl_handler_free(&isa->hdl);
err_dev_reg: err_dev_reg:
release_region(isa->io, region_size); release_region(isa->io, region_size);
kfree(isa); kfree(isa);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment