]> sjero.net Git - wget/commitdiff
gnutls: Fix a memory leak.
authorGiuseppe Scrivano <gscrivano@gnu.org>
Sun, 1 Apr 2012 14:30:59 +0000 (16:30 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Sun, 1 Apr 2012 14:30:59 +0000 (16:30 +0200)
src/ChangeLog
src/gnutls.c

index d58b15207d8c6a9c19c2bacae067c98a957bb448..2152cce3b629e70f1e47108e82eecf9cb40852f7 100644 (file)
@@ -1,5 +1,7 @@
 2012-04-01  Giuseppe Scrivano  <gscrivano@gnu.org>
 
+       * gnutls.c (wgnutls_read_timeout): Ensure timer is freed.
+
        * gnutls.c (wgnutls_read_timeout): Do not use timer if it is not
        allocated.
        Reported by: Xu Zhongxing <xu_zhong_xing@163.com>
index 2db5a90c5806d65b6d45eaf9b1dc45e66ed0416b..442b1364a311b34fd171dd51302ab99c06b863b2 100644 (file)
@@ -175,15 +175,13 @@ wgnutls_read_timeout (int fd, char *buf, int bufsize, void *arg, double timeout)
           if (timeout)
             {
 #ifdef F_GETFL
-              ret = fcntl (fd, F_SETFL, flags | O_NONBLOCK);
-              if (ret < 0)
-                return ret;
+              if (fcntl (fd, F_SETFL, flags | O_NONBLOCK))
+               break;
 #else
               /* XXX: Assume it was blocking before.  */
               const int one = 1;
-              ret = ioctl (fd, FIONBIO, &one);
-              if (ret < 0)
-                return ret;
+              if (ioctl (fd, FIONBIO, &one) < 0)
+               break;
 #endif
             }
 
@@ -191,16 +189,13 @@ wgnutls_read_timeout (int fd, char *buf, int bufsize, void *arg, double timeout)
 
           if (timeout)
             {
-              int status;
 #ifdef F_GETFL
-              status = fcntl (fd, F_SETFL, flags);
-              if (status < 0)
-                return status;
+              if (fcntl (fd, F_SETFL, flags) < 0)
+               break;
 #else
               const int zero = 0;
-              status = ioctl (fd, FIONBIO, &zero);
-              if (status < 0)
-                return status;
+              if (ioctl (fd, FIONBIO, &zero) < 0)
+               break;
 #endif
             }
         }