Re: [PATCH v2] i2c: dev: Fix memory leak when underlying adapter does not support I2C

From: Wolfram Sang
Date: Thu Nov 14 2024 - 05:46:01 EST


On Fri, Nov 08, 2024 at 12:15:42AM +0000, Igor Pylypiv wrote:
> Early return in i2cdev_ioctl_rdwr() failed to free the memory allocated
> by the caller. Move freeing the memory to the function where it has been
> allocated to prevent similar leaks in the future.
>
> Fixes: 97ca843f6ad3 ("i2c: dev: Check for I2C_FUNC_I2C before calling i2c_transfer")
> Signed-off-by: Igor Pylypiv <ipylypiv@xxxxxxxxxx>

Applied to for-next, thanks!

> + if (data_ptrs == NULL)

I changed this to '!data_ptrs' while here because most of the file does
it like this. And checkpatch and I prefer it, too.

Attachment: signature.asc
Description: PGP signature