diff options
author | Joshua Colp <jcolp@digium.com> | 2016-06-22 10:52:54 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-06-22 10:52:54 -0500 |
commit | aec09d9c09f04c886b15c731faee9f8d4fb9833f (patch) | |
tree | 408922f50c0f306d25933013fe12394b7825f1c6 /res/res_rtp_asterisk.c | |
parent | f88571822ce14e1137d19cb2785cddc7c4e8047f (diff) | |
parent | 804005d2517e8772d432a4bd3048030decb66cf4 (diff) |
Merge "res_rtp_asterisk: fix memory leak in dtls"
Diffstat (limited to 'res/res_rtp_asterisk.c')
-rw-r--r-- | res/res_rtp_asterisk.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 1bf16941d..119e45d87 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -1398,7 +1398,7 @@ static int ast_rtp_dtls_set_configuration(struct ast_rtp_instance *instance, con if (!ast_strlen_zero(dtls_cfg->certfile)) { char *private = ast_strlen_zero(dtls_cfg->pvtfile) ? dtls_cfg->certfile : dtls_cfg->pvtfile; BIO *certbio; - X509 *cert; + X509 *cert = NULL; const EVP_MD *type; unsigned int size, i; 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", dtls_cfg->certfile, instance); BIO_free_all(certbio); + if (cert) { + X509_free(cert); + } return -1; } @@ -1451,6 +1454,7 @@ static int ast_rtp_dtls_set_configuration(struct ast_rtp_instance *instance, con *(local_fingerprint-1) = 0; BIO_free_all(certbio); + X509_free(cert); } if (!ast_strlen_zero(dtls_cfg->cipher)) { |