[AC 21.5] Fix file descriptor leak in pop.c
Jerry James <[email protected]> Fri, 5 Dec 2014 16:22:36 -0700
| Newsgroups | gmane.emacs.xemacs.patches |
|---|---|
| Message-ID | <CAHCOHQkUhtC7netdxqCkDy3vqtctbLBwxWC7ucmvLhRaPkAsDw@mail.gmail.com> |
APPROVE COMMIT 21.5 I think this is one is obvious enough to fall under the obviously correct rule. The socket_connection() function in lib-src/pop.c closes the socket before returning on error in all but one case. This patch fixes up the remaining case. This bug was found by Coverity Scan. I will commit and push this patch shortly. diff -r b8316d3409cd lib-src/ChangeLog --- a/lib-src/ChangeLog Fri Nov 28 00:18:03 2014 +0000 +++ b/lib-src/ChangeLog Fri Dec 05 16:18:49 2014 -0700 @@ -1,3 +1,8 @@ +2014-12-05 Jerry James <[email protected]> + + * pop.c (socket_connection): Do not leak a socket if the POP + server's address cannot be determined. + 2014-10-18 Aidan Kehoe <[email protected]> * ootags.c (substitute): diff -r b8316d3409cd lib-src/pop.c --- a/lib-src/pop.c Fri Nov 28 00:18:03 2014 +0000 +++ b/lib-src/pop.c Fri Dec 05 16:18:49 2014 -0700 @@ -1075,6 +1075,7 @@ try_count++; if ((! hostent) && ((h_errno != TRY_AGAIN) || (try_count == 5))) { + CLOSESOCKET (sock); strcpy (pop_error, "Could not determine POP server's address"); return (-1); } -- Jerry James http://www.jamezone.org/