]> git.baikalelectronics.ru Git - kernel.git/commit
i2c: i2c-boardinfo: fix memory leaks on devinfo
authorColin Ian King <colin.king@canonical.com>
Wed, 22 Nov 2017 17:52:24 +0000 (17:52 +0000)
committerWolfram Sang <wsa@the-dreams.de>
Mon, 27 Nov 2017 18:14:29 +0000 (19:14 +0100)
commit6b86b1dd5c8efd38498c27bc131df9dcc66a72cc
tree2d15545273cc43033c0faeb353a09ffd30a7c7d5
parent59d545cdb0a82d819094b38f8d0c8a66887de4fc
i2c: i2c-boardinfo: fix memory leaks on devinfo

Currently when an error occurs devinfo is still allocated but is
unused when the error exit paths break out of the for-loop. Fix
this by kfree'ing devinfo to avoid the leak.

Detected by CoverityScan, CID#1416590 ("Resource Leak")

Fixes: b5d38abda0f7 ("i2c: allow attaching IRQ resources to i2c_board_info")
Fixes: 781bb263df2f ("i2c: copy device properties when using i2c_register_board_info()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/i2c-boardinfo.c