From 74c13f2f53a87f60fa3f7a7fdfb9c9313ae16332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20J=2E=20Saraiva?= Date: Sun, 10 Mar 2024 12:56:36 +0000 Subject: [PATCH] Fix resource leak in lnx_eth_init_socket --- common/linux_eth.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/linux_eth.c b/common/linux_eth.c index ae86b53ef..92ec2a70a 100644 --- a/common/linux_eth.c +++ b/common/linux_eth.c @@ -83,6 +83,7 @@ int lnx_eth_init_socket(char *device) if (bind(sck,(struct sockaddr *)&sa,sizeof(struct sockaddr_ll)) == -1) { fprintf(stderr,"eth_init_socket: bind: %s\n",strerror(errno)); + close(sck); return(-1); } @@ -90,6 +91,7 @@ int lnx_eth_init_socket(char *device) &mreq,sizeof(mreq)) == -1) { fprintf(stderr,"eth_init_socket: setsockopt: %s\n",strerror(errno)); + close(sck); return(-1); }