gnutls: fix an async handshake crash
authorDan Winship <danw@gnome.org>
Thu, 26 Jan 2012 12:56:51 +0000 (07:56 -0500)
committerDan Winship <danw@gnome.org>
Thu, 26 Jan 2012 12:56:51 +0000 (07:56 -0500)
g_tls_connection_gnutls_handshake_async() would cause a crash if the
handshake either succeeded or failed immediately (rather than getting
an EAGAIN after making partial progress).

https://bugzilla.gnome.org/show_bug.cgi?id=658771

tls/gnutls/gtlsconnection-gnutls.c

index f1655d6..4bed055 100644 (file)
@@ -969,6 +969,7 @@ g_tls_connection_gnutls_handshake_async (GTlsConnection       *conn,
       g_simple_async_result_set_op_res_gboolean (simple, TRUE);
       g_simple_async_result_complete_in_idle (simple);
       g_object_unref (simple);
+      return;
     }
   else if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
     {
@@ -976,6 +977,7 @@ g_tls_connection_gnutls_handshake_async (GTlsConnection       *conn,
       g_error_free (error);
       g_simple_async_result_complete_in_idle (simple);
       g_object_unref (simple);
+      return;
     }
   else if (error)
     g_error_free (error);