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: 4124c4eb ("i2c: allow attaching IRQ resources to i2c_board_info")
Fixes: 0daaf99d ("i2c: copy device properties when using i2c_register_board_info()")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
Showing
想要评论请 注册 或 登录