]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: i2c/tw9903: Fix potential memory leak in tw9903_probe()
authorAbdun Nihaal <nihaal@cse.iitm.ac.in>
Tue, 23 Dec 2025 05:48:13 +0000 (11:18 +0530)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 13 Jan 2026 12:21:03 +0000 (13:21 +0100)
In one of the error paths in tw9903_probe(), the memory allocated in
v4l2_ctrl_handler_init() and v4l2_ctrl_new_std() is not freed. Fix that
by calling v4l2_ctrl_handler_free() on the handler in that error path.

Cc: stable@vger.kernel.org
Fixes: 0890ec19c65d ("[media] tw9903: add new tw9903 video decoder")
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/i2c/tw9903.c

index b996a05e56f28f5e8dd71da0d7bfe0a1ba207dd1..c3eafd5d5dc82041c90fa0d4e9fc43bfacedaf74 100644 (file)
@@ -228,6 +228,7 @@ static int tw9903_probe(struct i2c_client *client)
 
        if (write_regs(sd, initial_registers) < 0) {
                v4l2_err(client, "error initializing TW9903\n");
+               v4l2_ctrl_handler_free(hdl);
                return -EINVAL;
        }