mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
res_rtp_asterisk.c: Fix memory leak in ephemeral certificate creation.
Fixes #386
(cherry picked from commit 74a5c452de
)
This commit is contained in:
committed by
Asterisk Development Team
parent
7f3a5b2be0
commit
81386086be
@@ -2029,9 +2029,12 @@ static int create_ephemeral_certificate(EVP_PKEY *keypair, X509 **certificate)
|
|||||||
if (!(serial = BN_new())
|
if (!(serial = BN_new())
|
||||||
|| !BN_rand(serial, SERIAL_RAND_BITS, -1, 0)
|
|| !BN_rand(serial, SERIAL_RAND_BITS, -1, 0)
|
||||||
|| !BN_to_ASN1_INTEGER(serial, X509_get_serialNumber(cert))) {
|
|| !BN_to_ASN1_INTEGER(serial, X509_get_serialNumber(cert))) {
|
||||||
|
BN_free(serial);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BN_free(serial);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validity period - Current Chrome & Firefox make it 31 days starting
|
* Validity period - Current Chrome & Firefox make it 31 days starting
|
||||||
* with yesterday at the current time, so we will do the same.
|
* with yesterday at the current time, so we will do the same.
|
||||||
@@ -2066,7 +2069,6 @@ static int create_ephemeral_certificate(EVP_PKEY *keypair, X509 **certificate)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
BN_free(serial);
|
|
||||||
X509_free(cert);
|
X509_free(cert);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
Reference in New Issue
Block a user