summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-01-03 19:27:06 +1000
committerPauli <paul.dale@oracle.com>2020-01-05 18:05:14 +1000
commit86723c2a103c763bc918dd70ffb3dd44ba5b5add (patch)
tree5fbafeb131957a08f1ef078747acd422ef87e927 /test
parent4c1e06fc400041a47c36c4d66b8bbda30219052f (diff)
coverity 1456639: fix NULL dereference
Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10748)
Diffstat (limited to 'test')
-rw-r--r--test/x509_time_test.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/x509_time_test.c b/test/x509_time_test.c
index 8e813cb0f9..a9292dff0f 100644
--- a/test/x509_time_test.c
+++ b/test/x509_time_test.c
@@ -327,10 +327,11 @@ static int test_X509_cmp_timeframe(void)
ASN1_TIME *asn1_before = ASN1_TIME_adj(NULL, now, -1, 0);
ASN1_TIME *asn1_after = ASN1_TIME_adj(NULL, now, 1, 0);
X509_VERIFY_PARAM *vpm = X509_VERIFY_PARAM_new();
- int res;
+ int res = 0;
- res = vpm != NULL
- && test_X509_cmp_timeframe_vpm(NULL, asn1_before, asn1_mid, asn1_after)
+ if (vpm == NULL)
+ goto finish;
+ res = test_X509_cmp_timeframe_vpm(NULL, asn1_before, asn1_mid, asn1_after)
&& test_X509_cmp_timeframe_vpm(vpm, asn1_before, asn1_mid, asn1_after);
X509_VERIFY_PARAM_set_time(vpm, now);
@@ -340,6 +341,7 @@ static int test_X509_cmp_timeframe(void)
&& test_X509_cmp_timeframe_vpm(vpm, asn1_before, asn1_mid, asn1_after);
X509_VERIFY_PARAM_free(vpm);
+finish:
ASN1_TIME_free(asn1_mid);
ASN1_TIME_free(asn1_before);
ASN1_TIME_free(asn1_after);