@@ -249,6 +249,7 @@ void Certificate::convertCertificateRequest(void* request, const void* issuer, v
249249 // Set the public key
250250 EVP_PKEY* public_key = X509_REQ_get_pubkey (cert_request);
251251 X509_set_pubkey (cert, public_key);
252+ EVP_PKEY_free (public_key);
252253
253254 // Set the extensions
254255 STACK_OF (X509_EXTENSION)* extensions = X509_REQ_get_extensions (cert_request);
@@ -278,7 +279,7 @@ void Certificate::convertCertificateRequest(void* request, const void* issuer, v
278279 if (val)
279280 {
280281 X509_add1_ext_i2d (cert, NID_issuer_alt_name, val, crit, 0 );
281- OPENSSL_free ( val);
282+ sk_GENERAL_NAME_pop_free (( STACK_OF (GENERAL_NAME)*) val, GENERAL_NAME_free );
282283 }
283284 }
284285
@@ -388,13 +389,11 @@ void Certificate::readInfos(Certificate& certificate)
388389 {
389390 void * ext = X509_get_ext_d2i (cert, NID_issuer_alt_name, nullptr , nullptr );
390391 certificate.m_x509v3_extensions .issuer_alternate_names = convertGeneralNames (ext);
391- OPENSSL_free (ext);
392392 }
393393 else if (extension_obj_nid == NID_subject_alt_name)
394394 {
395395 void * ext = X509_get_ext_d2i (cert, NID_subject_alt_name, nullptr , nullptr );
396396 certificate.m_x509v3_extensions .subject_alternate_names = convertGeneralNames (ext);
397- OPENSSL_free (ext);
398397 }
399398 else if (extension_obj_nid == NID_basic_constraints)
400399 {
@@ -411,7 +410,7 @@ void Certificate::readInfos(Certificate& certificate)
411410 static_cast <unsigned int >(ASN1_INTEGER_get (basic_constraint->pathlen ));
412411 }
413412 }
414- OPENSSL_free (basic_constraint);
413+ BASIC_CONSTRAINTS_free (basic_constraint);
415414 }
416415 }
417416 else
0 commit comments