X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=crypto%2Fasn1%2Fa_utctm.c;h=9144922ab4dc2317194b2e37f6bc039fabbffa56;hb=64b25758edca688a30f02c260262150f7ad0bc7d;hp=2dac3b58b4c629063cc6638c602c7d839cb1e4aa;hpb=f422a51486a3ab415153eccdc3c3746c53da01f4;p=openssl.git diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c index 2dac3b58b4..9144922ab4 100644 --- a/crypto/asn1/a_utctm.c +++ b/crypto/asn1/a_utctm.c @@ -58,7 +58,7 @@ #include #include -#include "cryptlib.h" +#include "internal/cryptlib.h" #include #include "asn1_locl.h" @@ -193,11 +193,11 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, int free_s = 0; if (s == NULL) { - free_s = 1; s = ASN1_UTCTIME_new(); + if (s == NULL) + goto err; + free_s = 1; } - if (s == NULL) - goto err; ts = OPENSSL_gmtime(&t, &data); if (ts == NULL) @@ -218,8 +218,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, ASN1err(ASN1_F_ASN1_UTCTIME_ADJ, ERR_R_MALLOC_FAILURE); goto err; } - if (s->data != NULL) - OPENSSL_free(s->data); + OPENSSL_free(s->data); s->data = (unsigned char *)p; } @@ -233,7 +232,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, #endif return (s); err: - if (free_s && s) + if (free_s) ASN1_UTCTIME_free(s); return NULL; }