[dpdk-dev] pdump: close client socket

Message ID 1467649049-22275-1-git-send-email-reshma.pattan@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Pattan, Reshma July 4, 2016, 4:17 p.m. UTC
  Close the client socket before returning on error.

Coverity issue: 127555

Fixes: f3c1829130ac ("pdump: check missing home environment variable")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 lib/librte_pdump/rte_pdump.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

John McNamara July 4, 2016, 4:31 p.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Reshma Pattan
> Sent: Monday, July 4, 2016 5:17 PM
> To: dev@dpdk.org
> Cc: Pattan, Reshma <reshma.pattan@intel.com>
> Subject: [dpdk-dev] [PATCH] pdump: close client socket
> 
> Close the client socket before returning on error.
> 
> Coverity issue: 127555
> 
> Fixes: f3c1829130ac ("pdump: check missing home environment variable")
> 
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>

Acked-by: John McNamara <john.mcnamara@intel.com>
  
Thomas Monjalon July 10, 2016, 1:01 p.m. UTC | #2
> > Close the client socket before returning on error.
> > 
> > Coverity issue: 127555
> > 
> > Fixes: f3c1829130ac ("pdump: check missing home environment variable")
> > 
> > Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> 
> Acked-by: John McNamara <john.mcnamara@intel.com>


Applied, thanks
  

Patch

diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index ee566cb..22ed476 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -677,7 +677,7 @@  pdump_create_client_socket(struct pdump_request *p)
 		RTE_LOG(ERR, PDUMP,
 			"Failed to get client socket path: %s:%d\n",
 			__func__, __LINE__);
-		return -1;
+		goto exit;
 	}
 	addr.sun_family = AF_UNIX;
 	addr_len = sizeof(struct sockaddr_un);
@@ -728,6 +728,7 @@  pdump_create_client_socket(struct pdump_request *p)
 		ret = server_resp.err_value;
 	} while (0);
 
+exit:
 	close(socket_fd);
 	unlink(addr.sun_path);
 	return ret;