summaryrefslogtreecommitdiff
path: root/debian/patches/connect_timeout_socket_leak.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/connect_timeout_socket_leak.patch')
-rw-r--r--debian/patches/connect_timeout_socket_leak.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/debian/patches/connect_timeout_socket_leak.patch b/debian/patches/connect_timeout_socket_leak.patch
new file mode 100644
index 0000000..95500a7
--- /dev/null
+++ b/debian/patches/connect_timeout_socket_leak.patch
@@ -0,0 +1,34 @@
+--- a/libtac/lib/connect.c
++++ b/libtac/lib/connect.c
+@@ -136,6 +136,7 @@
+
+ /* timeout */
+ if ( rc == 0 ) {
++ close(fd);
+ return LIBTAC_STATUS_CONN_TIMEOUT;
+ }
+
+@@ -143,6 +144,7 @@
+ if ( rc < 0 ) {
+ TACSYSLOG((LOG_ERR,\
+ "%s: connection failed with %s: %m", __FUNCTION__, ip))
++ close(fd);
+ return LIBTAC_STATUS_CONN_ERR;
+ }
+
+@@ -151,6 +153,7 @@
+ if(getpeername(fd, (struct sockaddr*)&addr, &len) == -1) {
+ TACSYSLOG((LOG_ERR,\
+ "%s: connection failed with %s: %m", __FUNCTION__, ip))
++ close(fd);
+ return LIBTAC_STATUS_CONN_ERR;
+ }
+
+@@ -158,6 +161,7 @@
+ if(fcntl(fd, F_SETFL, flags) == -1) {
+ TACSYSLOG((LOG_ERR, "%s: cannot restore socket flags: %m",\
+ __FUNCTION__))
++ close(fd);
+ return LIBTAC_STATUS_CONN_ERR;
+ }
+