Commit 48730a9d authored by Igor Pylypiv's avatar Igor Pylypiv Committed by Wolfram Sang
Browse files

i2c: dev: Fix memory leak when underlying adapter does not support I2C



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: 97ca843f ("i2c: dev: Check for I2C_FUNC_I2C before calling i2c_transfer")
Signed-off-by: default avatarIgor Pylypiv <ipylypiv@google.com>
[wsa: replaced '== NULL' with '!']
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
parent 433c6916
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment