[glib-networking/wip/pwithnall/dtls: 15/24] gnutls: Fix a potential release of a non-allocated FD



commit 89ab784d2a520af95cc7351a262a5b9284800606
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Jul 3 18:52:57 2015 +0100

    gnutls: Fix a potential release of a non-allocated FD
    
    If the initial allocation of the poll FD for this cancellable fails,
    there is no FD to release, so don’t try.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697908

 tls/gnutls/gtlsconnection-gnutls.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index aa0eae7..8d47594 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -667,8 +667,11 @@ claim_op (GTlsConnectionGnutls    *gnutls,
        nfds = 2;
       else
        nfds = 1;
+
       g_poll (fds, nfds, -1);
-      g_cancellable_release_fd (cancellable);
+
+      if (nfds > 1)
+        g_cancellable_release_fd (cancellable);
 
       goto try_again;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]