]> granicus.if.org Git - openssl/commitdiff
Avoid memory leak.
authorDr. Stephen Henson <steve@openssl.org>
Mon, 31 Jan 2005 01:40:39 +0000 (01:40 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 31 Jan 2005 01:40:39 +0000 (01:40 +0000)
crypto/asn1/a_verify.c

index b91678a9f6ecc59a166612d0a43b226daa508113..18ef0acf0029d3f3140d9f3556a8dec68104df56 100644 (file)
@@ -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);