diff options
author | Rich Salz <rsalz@openssl.org> | 2015-04-30 11:30:03 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-04-30 11:31:07 -0400 |
commit | 2ace745022f5af0709297e96eb0b0829c87c4291 (patch) | |
tree | 4352672cd8681d1df32edd39443c50a98fe0b065 /crypto/x509 | |
parent | 5a80d9fbfe445420ffe6b649f29e2e0c412aba5d (diff) | |
download | openssl-2ace745022f5af0709297e96eb0b0829c87c4291.tar.gz |
free NULL cleanup 8
Do not check for NULL before calling a free routine. This addresses:
ASN1_BIT_STRING_free ASN1_GENERALIZEDTIME_free ASN1_INTEGER_free
ASN1_OBJECT_free ASN1_OCTET_STRING_free ASN1_PCTX_free ASN1_SCTX_free
ASN1_STRING_clear_free ASN1_STRING_free ASN1_TYPE_free
ASN1_UTCTIME_free M_ASN1_free_of
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/x509')
-rw-r--r-- | crypto/x509/x509_vpm.c | 16 | ||||
-rw-r--r-- | crypto/x509/x_attrib.c | 3 |
2 files changed, 7 insertions, 12 deletions
diff --git a/crypto/x509/x509_vpm.c b/crypto/x509/x509_vpm.c index 2c30ff4026..009255e365 100644 --- a/crypto/x509/x509_vpm.c +++ b/crypto/x509/x509_vpm.c @@ -144,15 +144,11 @@ static void x509_verify_param_zero(X509_VERIFY_PARAM *param) param->inh_flags = 0; param->flags = 0; param->depth = -1; - if (param->policies) { - sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free); - param->policies = NULL; - } + sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free); + param->policies = NULL; paramid = param->id; - if (paramid->hosts) { - string_stack_free(paramid->hosts); - paramid->hosts = NULL; - } + string_stack_free(paramid->hosts); + paramid->hosts = NULL; if (paramid->peername) OPENSSL_free(paramid->peername); if (paramid->email) { @@ -426,10 +422,10 @@ int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, { int i; ASN1_OBJECT *oid, *doid; + if (!param) return 0; - if (param->policies) - sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free); + sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free); if (!policies) { param->policies = NULL; diff --git a/crypto/x509/x_attrib.c b/crypto/x509/x_attrib.c index a07a5da139..9ff6dcc687 100644 --- a/crypto/x509/x_attrib.c +++ b/crypto/x509/x_attrib.c @@ -100,7 +100,6 @@ X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value) err: if (ret != NULL) X509_ATTRIBUTE_free(ret); - if (val != NULL) - ASN1_TYPE_free(val); + ASN1_TYPE_free(val); return (NULL); } |