octeontx2-af: fix memory leak of lmac and lmac->name
authorColin Ian King <colin.king@canonical.com>
Thu, 7 Jan 2021 12:39:16 +0000 (12:39 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Jan 2021 13:16:57 +0000 (14:16 +0100)
commit2e7635299fbf20f517e5516e5d84abbd1f4a2c49
tree5072b4c6753718b94e5df8a366ace2015ce8a323
parentab8e7a1af3f24f0477a27782731b818b1ae5a2e4
octeontx2-af: fix memory leak of lmac and lmac->name

[ Upstream commit ac7996d680d8b4a51bb99bbdcee3dc838b985498 ]

Currently the error return paths don't kfree lmac and lmac->name
leading to some memory leaks.  Fix this by adding two error return
paths that kfree these objects

Addresses-Coverity: ("Resource leak")
Fixes: 1463f382f58d ("octeontx2-af: Add support for CGX link management")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210107123916.189748-1-colin.king@canonical.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/marvell/octeontx2/af/cgx.c