From 51e357cb8decceaeab47332492962bc0175b0b13 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 13 Apr 2013 21:50:13 +0200 Subject: [PATCH] Fix a socket leak in HTTPInput. --- httpinput.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/httpinput.cpp b/httpinput.cpp index 9d39774..291b17f 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -114,6 +114,15 @@ int HTTPInput::lookup_and_connect(const string &host, const string &port) return sock; } + do { + err = close(sock); + } while (err == -1 && errno == EINTR); + + if (err == -1) { + perror("close"); + // Can still continue. + } + ai = ai->ai_next; } -- 2.39.2