From 2deadf1672b11e352a596629643e45611e5a6962 Mon Sep 17 00:00:00 2001
From: "Dr. Stephen Henson" <steve@openssl.org>
Date: Tue, 26 Apr 2005 23:21:49 +0000
Subject: [PATCH] Port from stable branch.

---
 ChangeLog.0_9_7-stable_not-in-head |  7 -------
 crypto/asn1/a_verify.c             | 13 +++++++------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/ChangeLog.0_9_7-stable_not-in-head b/ChangeLog.0_9_7-stable_not-in-head
index 297ddb4e43..bbb369bf30 100644
--- a/ChangeLog.0_9_7-stable_not-in-head
+++ b/ChangeLog.0_9_7-stable_not-in-head
@@ -766,13 +766,6 @@ be added to the end of this file.
 	Remove VMS_strcasecmp() from apps.c, it's not used any more.  And
 	besides, the implementation is bogus.
 
-2005-01-31 02:40  steve
-
-	Changed:
-		crypto/asn1/a_verify.c (1.12.2.3), "Exp", lines: +7 -6
-
-	Avoid memory leak.
-
 2005-01-31 02:46  steve
 
 	Changed:
diff --git a/crypto/asn1/a_verify.c b/crypto/asn1/a_verify.c
index e7ba32f3f1..05329277a2 100644
--- a/crypto/asn1/a_verify.c
+++ b/crypto/asn1/a_verify.c
@@ -142,6 +142,13 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
 		goto err;
 		}
 
+	if (!EVP_VerifyInit_ex(&ctx,type, NULL))
+		{
+		ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_EVP_LIB);
+		ret=0;
+		goto err;
+		}
+
 	inl = ASN1_item_i2d(asn, &buf_in, it);
 	
 	if (buf_in == NULL)
@@ -150,12 +157,6 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
 		goto err;
 		}
 
-	if (!EVP_VerifyInit_ex(&ctx,type, NULL))
-		{
-		ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_EVP_LIB);
-		ret=0;
-		goto err;
-		}
 	EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
 
 	OPENSSL_cleanse(buf_in,(unsigned int)inl);
-- 
2.25.1