[vlc-commits] gnutls: fix flawed logic

Rémi Denis-Courmont git at videolan.org
Sat Aug 30 11:50:25 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 30 12:50:04 2014 +0300| [fed7e7951b9cc782c27abab47760ded69360a381] | committer: Rémi Denis-Courmont

gnutls: fix flawed logic

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fed7e7951b9cc782c27abab47760ded69360a381
---

 modules/misc/gnutls.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/modules/misc/gnutls.c b/modules/misc/gnutls.c
index 18e1985..c77536c 100644
--- a/modules/misc/gnutls.c
+++ b/modules/misc/gnutls.c
@@ -198,9 +198,9 @@ static int gnutls_SessionOpen (vlc_tls_t *tls, int type,
         goto error;
     }
 
-#ifdef GNUTLS_ALPN_MAND
     if (alpn != NULL)
     {
+#ifdef GNUTLS_ALPN_MAND
         gnutls_datum_t *protv = NULL;
         unsigned protc = 0;
 
@@ -222,10 +222,10 @@ static int gnutls_SessionOpen (vlc_tls_t *tls, int type,
 
         val = gnutls_alpn_set_protocols (session, protv, protc, 0);
         free (protv);
-    }
 #else
-    VLC_UNUSED(alpn);
+        goto error;
 #endif
+    }
 
     gnutls_transport_set_int (session, fd);
 
@@ -279,9 +279,9 @@ static int gnutls_ContinueHandshake (vlc_tls_t *tls, char **restrict alp)
     return -1;
 
 done:
-#ifdef GNUTLS_ALPN_MAND
     if (alp != NULL)
     {
+#ifdef GNUTLS_ALPN_MAND
         gnutls_datum_t datum;
 
         val = gnutls_alpn_get_selected_protocol (session, &datum);
@@ -295,11 +295,9 @@ done:
                 return -1;
         }
         else
+#endif
             *alp = NULL;
     }
-#else
-    VLC_UNUSED(alp);
-#endif
     return 0;
 }
 



More information about the vlc-commits mailing list