Fix various memory leaks in SSL, apps and DSA
[openssl.git] / ssl / s2_clnt.c
index 0c138420145a9d52a8adcac17ee8e18827916a47..9c8037b48bf682eba5a394a9c46f4c849e996b76 100644 (file)
@@ -953,8 +953,9 @@ unsigned char *data;
                goto err;
        ret=1;
 err:
-       if (sk != NULL) sk_free(sk);
-       if (x509 != NULL) X509_free(x509);
+       sk_free(sk);
+       X509_free(x509);
+       EVP_PKEY_free(pkey);
        return(ret);
        }
 
@@ -985,6 +986,7 @@ int padding;
        if (i < 0)
                SSLerr(SSL_F_SSL_RSA_PUBLIC_ENCRYPT,ERR_R_RSA_LIB);
 end:
+       EVP_PKEY_free(pkey);
        return(i);
        }