crypto/asn1/a_time.c: Add check for OPENSSL_malloc
[openssl.git] / crypto / asn1 / a_time.c
index 4b9a0641fb10627c9f8713b663e403166999139e..a92cdaa89e432882989bbec533398570ed85edff 100644 (file)
@@ -618,7 +618,10 @@ time_t asn1_string_to_time_t(const char *asn1_string)
     }
 
     timestamp_tm = OPENSSL_malloc(sizeof(*timestamp_tm));
-
+    if (timestamp_tm == NULL) {
+        ASN1_TIME_free(timestamp_asn1);
+        return -1;
+    }
     if (!(ASN1_TIME_to_tm(timestamp_asn1, timestamp_tm))) {
         OPENSSL_free(timestamp_tm);
         ASN1_TIME_free(timestamp_asn1);