web: Fix possible file descriptor leak in `open-socket-for-uri'.
authorLudovic Courtès <ludo@gnu.org>
Sat, 13 Oct 2012 19:13:10 +0000 (21:13 +0200)
committerLudovic Courtès <ludo@gnu.org>
Sat, 13 Oct 2012 19:13:10 +0000 (21:13 +0200)
* module/web/client.scm (open-socket-for-uri): Always close S in the
  `system-error' handler.

module/web/client.scm

index 27458a4..cf7ea53 100644 (file)
           s)
         (lambda args
           ;; Connection failed, so try one of the other addresses.
+          (close s)
           (if (null? addresses)
               (apply throw args)
-              (begin
-                (close s)
-                (loop (cdr addresses)))))))))
+              (loop (cdr addresses))))))))
 
 (define (decode-string bv encoding)
   (if (string-ci=? encoding "utf-8")