certificates: Use shared destructor for x509_cdp_t

This commit is contained in:
Tobias Brunner
2017-09-18 10:54:19 +02:00
parent e7276f78aa
commit 4e7b7db62f
6 changed files with 22 additions and 46 deletions
@@ -188,16 +188,6 @@ struct private_openssl_x509_t {
refcount_t ref;
};
/**
* Destroy a CRL URI struct
*/
static void crl_uri_destroy(x509_cdp_t *this)
{
free(this->uri);
DESTROY_IF(this->issuer);
free(this);
}
/**
* Convert a GeneralName to an identification_t.
*/
@@ -549,7 +539,8 @@ METHOD(certificate_t, destroy, void,
offsetof(identification_t, destroy));
this->issuerAltNames->destroy_offset(this->issuerAltNames,
offsetof(identification_t, destroy));
this->crl_uris->destroy_function(this->crl_uris, (void*)crl_uri_destroy);
this->crl_uris->destroy_function(this->crl_uris,
(void*)x509_cdp_destroy);
this->ocsp_uris->destroy_function(this->ocsp_uris, free);
this->ipAddrBlocks->destroy_offset(this->ipAddrBlocks,
offsetof(traffic_selector_t, destroy));
+2 -11
View File
@@ -240,16 +240,6 @@ static bool gn_to_string(identification_t *id, char **uri)
return len > 0;
}
/**
* Destroy a CertificateDistributionPoint
*/
static void crl_uri_destroy(x509_cdp_t *this)
{
free(this->uri);
DESTROY_IF(this->issuer);
free(this);
}
/**
* Destroy a CertificatePolicy
*/
@@ -1920,7 +1910,8 @@ METHOD(certificate_t, destroy, void,
{
this->subjectAltNames->destroy_offset(this->subjectAltNames,
offsetof(identification_t, destroy));
this->crl_uris->destroy_function(this->crl_uris, (void*)crl_uri_destroy);
this->crl_uris->destroy_function(this->crl_uris,
(void*)x509_cdp_destroy);
this->ocsp_uris->destroy_function(this->ocsp_uris, free);
this->ipAddrBlocks->destroy_offset(this->ipAddrBlocks,
offsetof(traffic_selector_t, destroy));
+2 -11
View File
@@ -585,23 +585,14 @@ static void revoked_destroy(revoked_t *revoked)
free(revoked);
}
/**
* Destroy a CDP entry
*/
static void cdp_destroy(x509_cdp_t *this)
{
free(this->uri);
DESTROY_IF(this->issuer);
free(this);
}
METHOD(certificate_t, destroy, void,
private_x509_crl_t *this)
{
if (ref_put(&this->ref))
{
this->revoked->destroy_function(this->revoked, (void*)revoked_destroy);
this->crl_uris->destroy_function(this->crl_uris, (void*)cdp_destroy);
this->crl_uris->destroy_function(this->crl_uris,
(void*)x509_cdp_destroy);
DESTROY_IF(this->issuer);
free(this->authKeyIdentifier.ptr);
free(this->encoding.ptr);