Skip to contentSkip to conversation

meson: vdec: fix possible refcount leak in vdec_probe()

PATCH New Hangyu Hua 1 participant 1 message Sep 6, 2022

Subsystems (4)
lore
Share & tools
lore

Hangyu Hua

author
#0 lore raw

PATCH 1/1 meson: vdec: fix possible refcount leak in vdec_probe()

v4l2_device_unregister need to be called to put the refount got by v4l2_device_register when vdec_probe fails or vdec_remove is called.

---
 drivers/staging/media/meson/vdec/vdec.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/staging/media/meson/vdec/vdec.c +2 -0
index 8549d95be0f2..52f224d8def1 100644
@@ -1102,6 +1102,7 @@ static int vdec_probe(struct platform_device *pdev)
 
 err_vdev_release:
 	video_device_release(vdev);
+	v4l2_device_unregister(&core->v4l2_dev);
 	return ret;
 }
 
@@ -1110,6 +1111,7 @@ static int vdec_remove(struct platform_device *pdev)
 	struct amvdec_core *core = platform_get_drvdata(pdev);
 
 	video_unregister_device(core->vdev_dec);
+	v4l2_device_unregister(&core->v4l2_dev);
 
 	return 0;
 }
Signature · 1 line
2.34.1