Minor optimizations (original by Peter Vaskovic, modified by Paul Bakker)

Move strlen out of for loop.
Remove redundant null checks before free.
diff --git a/library/ssl_srv.c b/library/ssl_srv.c
index 5152895..53b3179 100644
--- a/library/ssl_srv.c
+++ b/library/ssl_srv.c
@@ -691,7 +691,7 @@
 static int ssl_parse_alpn_ext( ssl_context *ssl,
                                unsigned char *buf, size_t len )
 {
-    size_t list_len, cur_len;
+    size_t list_len, cur_len, ours_len;
     const unsigned char *theirs, *start, *end;
     const char **ours;
 
@@ -722,6 +722,7 @@
     end = buf + len;
     for( ours = ssl->alpn_list; *ours != NULL; ours++ )
     {
+        ours_len = strlen( *ours );
         for( theirs = start; theirs != end; theirs += cur_len )
         {
             /* If the list is well formed, we should get equality first */
@@ -734,7 +735,7 @@
             if( cur_len == 0 )
                 return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
 
-            if( cur_len == strlen( *ours ) &&
+            if( cur_len == ours_len &&
                 memcmp( theirs, *ours, cur_len ) == 0 )
             {
                 ssl->alpn_chosen = *ours;