Skip to content
Commit 704a940d authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman
Browse files

thunderbolt: fix memory leak of object sw



In the case where the call tb_switch_exceeds_max_depth is true
the error reurn path leaks memory in sw.  Fix this by setting
the return error code to -EADDRNOTAVAIL and returning via the
error exit path err_free_sw_ports to free sw. sw has been kzalloc'd
so the free of the NULL sw->ports is fine.

Addresses-Coverity: ("Resource leak")
Fixes: b0407983 ("thunderbolt: Add initial support for USB4")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Link: https://lore.kernel.org/r/20191220220526.11307-1-colin.king@canonical.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 845f0810
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment