ensure that cert bios get freed after creating the fingerprint
ASTERISK-26129 #close
Change-Id: I44d23aea07dce80176ca1ff877c5ace9452ef451
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];
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;
}
*(local_fingerprint-1) = 0;
BIO_free_all(certbio);
+ X509_free(cert);
}
if (!ast_strlen_zero(dtls_cfg->cipher)) {