summaryrefslogtreecommitdiffstats
path: root/crypto/asn1
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2017-03-21 09:07:17 +0000
committerMatt Caswell <matt@openssl.org>2017-03-21 14:07:50 +0000
commitffcdb0e6efb6fb7033b2cd29e8cca2e2fe355c14 (patch)
tree9946c26ab1d20658a4739f380f040f6dfe90f595 /crypto/asn1
parent3f640ebd035006d44d6f7d0767bb6ebd1a2efcd5 (diff)
Fix error paths in ASN1_TIME_to_generalizedtime
We should not write to |out| in error cases, so we should defer doing this until the "done" block. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3002)
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/a_time.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c
index 6074325816..0eeb79cd42 100644
--- a/crypto/asn1/a_time.c
+++ b/crypto/asn1/a_time.c
@@ -147,10 +147,9 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t,
if (!out || !*out) {
if (!(ret = ASN1_GENERALIZEDTIME_new()))
goto err;
- if (out)
- *out = ret;
- } else
+ } else {
ret = *out;
+ }
/* If already GeneralizedTime just copy across */
if (t->type == V_ASN1_GENERALIZEDTIME) {