Initialize pval.
[oweals/openssl.git] / apps / s_client.c
index 138aa3126bbc4553bdc99c2d4e637c7c94f9cd7a..251da63ed542873e1f8db2f792dd0c13cc816de0 100644 (file)
@@ -223,8 +223,8 @@ static unsigned int psk_client_cb(SSL *ssl, const char *hint, char *identity,
                BIO_printf(bio_c_out, "Received PSK identity hint '%s'\n", hint);
 
        /* lookup PSK identity and PSK key based on the given identity hint here */
-       ret = snprintf(identity, max_identity_len, psk_identity);
-       if (ret < 0 || ret > max_identity_len)
+       ret = BIO_snprintf(identity, max_identity_len, psk_identity);
+       if (ret < 0 || (unsigned int)ret > max_identity_len)
                goto out_err;
        if (c_debug)
                BIO_printf(bio_c_out, "created identity '%s' len=%d\n", identity, ret);
@@ -237,7 +237,7 @@ static unsigned int psk_client_cb(SSL *ssl, const char *hint, char *identity,
                 return 0;
                 }
 
-        if (BN_num_bytes(bn) > max_psk_len)
+        if ((unsigned int)BN_num_bytes(bn) > max_psk_len)
                 {
                 BIO_printf(bio_err,"psk buffer of callback is too small (%d) for key (%d)\n",
                         max_psk_len, BN_num_bytes(bn));
@@ -348,7 +348,7 @@ int MAIN(int, char **);
 int MAIN(int argc, char **argv)
        {
        int off=0;
-       SSL *con=NULL,*con2=NULL;
+       SSL *con=NULL;
        X509_STORE *store = NULL;
        int s,k,width,state=0;
        char *cbuf=NULL,*sbuf=NULL,*mbuf=NULL;
@@ -1237,9 +1237,12 @@ shut:
        SHUTDOWN(SSL_get_fd(con));
        ret=0;
 end:
-       if(prexit) print_stuff(bio_c_out,con,1);
-       if (con != NULL) SSL_free(con);
-       if (con2 != NULL) SSL_free(con2);
+       if (con != NULL)
+               {
+               if (prexit != 0)
+                       print_stuff(bio_c_out,con,1);
+               SSL_free(con);
+               }
        if (ctx != NULL) SSL_CTX_free(ctx);
        if (cert)
                X509_free(cert);