summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-05-12 11:49:32 -0400
committerRich Salz <rsalz@openssl.org>2015-05-13 12:56:38 -0400
commit155ca14ea9fa64808782eca2b29583cfd9ff4d7f (patch)
tree56d1667faa47fb6907c2d024ba9c6f97aa765448
parent303845a3b5ee7b999bf79e2e42c1489c2cc9f371 (diff)
Add NULL checks from master
The big "don't check for NULL" cleanup requires backporting some of the lowest-level functions to actually do nothing if NULL is given. This will make it easier to backport fixes to release branches, where master assumes those lower-level functions are "safe" This commit addresses those tickets: 3798 3799 3801. Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit f34b095fab1569d093b639bfcc9a77d6020148ff) (cherry picked from commit 690d040b2e9df9c6ac19e1aab8f0cd79a84a2ee4)
-rw-r--r--crypto/x509/x509_lu.c2
-rw-r--r--crypto/x509/x509_vfy.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c
index 684ef5f25c..a1afb6c08d 100644
--- a/crypto/x509/x509_lu.c
+++ b/crypto/x509/x509_lu.c
@@ -214,6 +214,8 @@ X509_STORE *X509_STORE_new(void)
static void cleanup(X509_OBJECT *a)
{
+ if (!a)
+ return;
if (a->type == X509_LU_X509) {
X509_free(a->data.x509);
} else if (a->type == X509_LU_CRL) {
diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c
index e11cd5d0ea..4fa493c9ff 100644
--- a/crypto/x509/x509_vfy.c
+++ b/crypto/x509/x509_vfy.c
@@ -1304,6 +1304,8 @@ X509_STORE_CTX *X509_STORE_CTX_new(void)
void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
{
+ if (!ctx)
+ return;
X509_STORE_CTX_cleanup(ctx);
OPENSSL_free(ctx);
}