net/nfp: close sockfd before return if errors
Checks
Commit Message
Not closing the socket implies a resource leak.
Coverity issue: 336865
Fixes: 29a62d1476b6 ("net/nfp: add CPP bridge as service")
Cc: stable@dpdk.org
Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
drivers/net/nfp/nfp_net.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On 4/8/2019 12:02 PM, Alejandro Lucero wrote:
> Not closing the socket implies a resource leak.
>
> Coverity issue: 336865
> Fixes: 29a62d1476b6 ("net/nfp: add CPP bridge as service")
> Cc: stable@dpdk.org
>
> Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Applied to dpdk-next-net/master, thanks.
@@ -3301,6 +3301,7 @@ nfp_cpp_bridge_service_func(void *args)
if (ret < 0) {
RTE_LOG(ERR, PMD, "%s: bind error (%d). Service failed\n",
__func__, errno);
+ close(sockfd);
return ret;
}
@@ -3308,6 +3309,7 @@ nfp_cpp_bridge_service_func(void *args)
if (ret < 0) {
RTE_LOG(ERR, PMD, "%s: listen error(%d). Service failed\n",
__func__, errno);
+ close(sockfd);
return ret;
}
@@ -3317,6 +3319,7 @@ nfp_cpp_bridge_service_func(void *args)
RTE_LOG(ERR, PMD, "%s: accept call error (%d)\n",
__func__, errno);
RTE_LOG(ERR, PMD, "%s: service failed\n", __func__);
+ close(sockfd);
return -EIO;
}