@@ -812,7 +812,7 @@ static av_cold int openssl_init_ca_key_cert(URLContext *h)
812
812
int ret ;
813
813
TLSContext * p = h -> priv_data ;
814
814
TLSShared * c = & p -> tls_shared ;
815
- EVP_PKEY * pkey = p -> pkey ;
815
+ EVP_PKEY * pkey = NULL ;
816
816
X509 * cert = NULL ;
817
817
/* setup ca, private key, certificate */
818
818
if (c -> ca_file ) {
@@ -850,7 +850,7 @@ static av_cold int openssl_init_ca_key_cert(URLContext *h)
850
850
goto fail ;
851
851
}
852
852
} else if (p -> tls_shared .key_buf ) {
853
- pkey = pkey_from_pem_string (p -> tls_shared .key_buf , 1 );
853
+ p -> pkey = pkey = pkey_from_pem_string (p -> tls_shared .key_buf , 1 );
854
854
if (SSL_CTX_use_PrivateKey (p -> ctx , pkey ) != 1 ) {
855
855
av_log (p , AV_LOG_ERROR , "TLS: Init SSL_CTX_use_PrivateKey failed, %s\n" , openssl_get_error (p ));
856
856
ret = AVERROR (EINVAL );
@@ -878,7 +878,7 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
878
878
c -> is_dtls = 1 ;
879
879
const char * ciphers = "ALL" ;
880
880
#if OPENSSL_VERSION_NUMBER < 0x10002000L // v1.0.2
881
- EC_KEY * ec_key ;
881
+ EC_KEY * ec_key = NULL ;
882
882
#endif
883
883
/**
884
884
* The profile for OpenSSL's SRTP is SRTP_AES128_CM_SHA1_80, see ssl/d1_srtp.c.
@@ -1007,6 +1007,9 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
1007
1007
1008
1008
ret = 0 ;
1009
1009
fail :
1010
+ #if OPENSSL_VERSION_NUMBER < 0x10002000L // v1.0.2
1011
+ EC_KEY_free (ec_key );
1012
+ #endif
1010
1013
return ret ;
1011
1014
}
1012
1015
0 commit comments