mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-18 10:44:28 +00:00
Merge "res_rtp_asterisk: fix memory leak in dtls"
This commit is contained in:
@@ -1398,7 +1398,7 @@ static int ast_rtp_dtls_set_configuration(struct ast_rtp_instance *instance, con
|
|||||||
if (!ast_strlen_zero(dtls_cfg->certfile)) {
|
if (!ast_strlen_zero(dtls_cfg->certfile)) {
|
||||||
char *private = ast_strlen_zero(dtls_cfg->pvtfile) ? dtls_cfg->certfile : dtls_cfg->pvtfile;
|
char *private = ast_strlen_zero(dtls_cfg->pvtfile) ? dtls_cfg->certfile : dtls_cfg->pvtfile;
|
||||||
BIO *certbio;
|
BIO *certbio;
|
||||||
X509 *cert;
|
X509 *cert = NULL;
|
||||||
const EVP_MD *type;
|
const EVP_MD *type;
|
||||||
unsigned int size, i;
|
unsigned int size, i;
|
||||||
unsigned char fingerprint[EVP_MAX_MD_SIZE];
|
unsigned char fingerprint[EVP_MAX_MD_SIZE];
|
||||||
@@ -1440,6 +1440,9 @@ static int ast_rtp_dtls_set_configuration(struct ast_rtp_instance *instance, con
|
|||||||
ast_log(LOG_ERROR, "Could not produce fingerprint from certificate '%s' for RTP instance '%p'\n",
|
ast_log(LOG_ERROR, "Could not produce fingerprint from certificate '%s' for RTP instance '%p'\n",
|
||||||
dtls_cfg->certfile, instance);
|
dtls_cfg->certfile, instance);
|
||||||
BIO_free_all(certbio);
|
BIO_free_all(certbio);
|
||||||
|
if (cert) {
|
||||||
|
X509_free(cert);
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1451,6 +1454,7 @@ static int ast_rtp_dtls_set_configuration(struct ast_rtp_instance *instance, con
|
|||||||
*(local_fingerprint-1) = 0;
|
*(local_fingerprint-1) = 0;
|
||||||
|
|
||||||
BIO_free_all(certbio);
|
BIO_free_all(certbio);
|
||||||
|
X509_free(cert);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ast_strlen_zero(dtls_cfg->cipher)) {
|
if (!ast_strlen_zero(dtls_cfg->cipher)) {
|
||||||
|
Reference in New Issue
Block a user