From 701e0bfa84f59df16f51347f71f4ade56347b645 Mon Sep 17 00:00:00 2001 From: Alejandro Lucero Date: Mon, 8 Apr 2019 12:02:04 +0100 Subject: [PATCH] net/nfp: fix resource leak on errors 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 --- drivers/net/nfp/nfp_net.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index d4c94d7ccd..b2ff03a675 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -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; } -- 2.20.1