Coverity 1528492: Fix possible memory leak if t == NULL
authorTomas Mraz <tomas@openssl.org>
Wed, 7 Jun 2023 11:56:54 +0000 (13:56 +0200)
committerTodd Short <todd.short@me.com>
Sat, 10 Jun 2023 23:23:59 +0000 (19:23 -0400)
crypto/asn1/a_time.c

index 4f51a6bc4ab3c9eceec58e51f3d5dd0b00a0cc03..dd3724fc836f1630f07b5e3e49733c659eb3737c 100644 (file)
@@ -569,7 +569,7 @@ int ASN1_TIME_normalize(ASN1_TIME *t)
 {
     struct tm tm;
 
-    if (!ASN1_TIME_to_tm(t, &tm))
+    if (t == NULL || !ASN1_TIME_to_tm(t, &tm))
         return 0;
 
     return ossl_asn1_time_from_tm(t, &tm, V_ASN1_UNDEF) != NULL;