In the Linux kernel, the following vulnerability has been resolved: media: ov5675: Fix memleak in ov5675initcontrols() There is a kmemleak when testing the media/i2c/ov5675.c with bpf mock device: AssertionError: unreferenced object 0xffff888107362160 (size 16): comm "python3", pid 277, jiffies 4294832798 (age 20.722s) hex dump (first 16 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000abe7d67c>] _kmallocnode+0x44/0x1b0 [<000000008a725aac>] kvmallocnode+0x34/0x180 [<000000009a53cd11>] v4l2ctrlhandlerinitclass+0x11d/0x180 [videodev] [<0000000055b46db0>] ov5675probe+0x38b/0x897 [ov5675] [<00000000153d886c>] i2cdeviceprobe+0x28d/0x680 [<000000004afb7e8f>] reallyprobe+0x17c/0x3f0 [<00000000ff2f18e4>] _driverprobedevice+0xe3/0x170 [<000000000a001029>] driverprobedevice+0x49/0x120 [<00000000e39743c7>] _deviceattachdriver+0xf7/0x150 [<00000000d32fd070>] busforeachdrv+0x114/0x180 [<000000009083ac41>] _deviceattach+0x1e5/0x2d0 [<0000000015b4a830>] busprobedevice+0x126/0x140 [<000000007813deaf>] deviceadd+0x810/0x1130 [<000000007becb867>] i2cnewclientdevice+0x386/0x540 [<000000007f9cf4b4>] ofi2cregisterdevice+0xf1/0x110 [<00000000ebfdd032>] ofi2cnotify+0xfc/0x1f0 ov5675initcontrols() won't clean all the allocated resources in fail path, which may causes the memleaks. Add v4l2ctrlhandlerfree() to prevent memleak.