Commit ffcdb0e6 authored by Matt Caswell's avatar Matt Caswell
Browse files

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: default avatarRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3002)
parent 3f640ebd
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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) {