summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/asn1_lib.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2015-03-24 12:52:24 +0100
committerRich Salz <rsalz@openssl.org>2015-03-24 12:52:24 +0100
commit0dfb9398bb6493d5a56216e0c7039cb3f9fc88c6 (patch)
tree9ffaa0bec3d0f14092948174eeea90dc8e2ee7c4 /crypto/asn1/asn1_lib.c
parentFix malloc define typo (diff)
downloadopenssl-0dfb9398bb6493d5a56216e0c7039cb3f9fc88c6.tar.xz
openssl-0dfb9398bb6493d5a56216e0c7039cb3f9fc88c6.zip
free NULL cleanup
Start ensuring all OpenSSL "free" routines allow NULL, and remove any if check before calling them. This gets ASN1_OBJECT_free and ASN1_STRING_free. Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto/asn1/asn1_lib.c')
-rw-r--r--crypto/asn1/asn1_lib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c
index fe63b6249c..2e36cff055 100644
--- a/crypto/asn1/asn1_lib.c
+++ b/crypto/asn1/asn1_lib.c
@@ -429,7 +429,9 @@ void ASN1_STRING_free(ASN1_STRING *a)
void ASN1_STRING_clear_free(ASN1_STRING *a)
{
- if (a && a->data && !(a->flags & ASN1_STRING_FLAG_NDEF))
+ if (a == NULL)
+ return;
+ if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF))
OPENSSL_cleanse(a->data, a->length);
ASN1_STRING_free(a);
}