pval must always be set when pk7_cb() does anything (Coverity ID 146).
[openssl.git] / crypto / pkcs7 / pk7_asn1.c
index 339f89365b16af8ec8d60397550159fd8e077734..b7ec2883cb327508fe4d1fc2dfa47450dd403cac 100644 (file)
@@ -1,5 +1,5 @@
 /* pk7_asn.c */
-/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
+/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project 2000.
  */
 /* ====================================================================
@@ -82,26 +82,23 @@ static int pk7_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
                                                        void *exarg)
 {
        ASN1_STREAM_ARG *sarg = exarg;
-       PKCS7 *p7;
-       if (pval)
-               p7 = (PKCS7 *)*pval;
-       else
-               p7 = NULL;
+       PKCS7 **pp7 = (PKCS7 **)pval;
+
        switch(operation)
                {
 
                case ASN1_OP_STREAM_PRE:
-               if (PKCS7_stream(&sarg->boundary, p7) <= 0)
+               if (PKCS7_stream(&sarg->boundary, *pp7) <= 0)
                        return 0;
                case ASN1_OP_DETACHED_PRE:
-               sarg->ndef_bio = PKCS7_dataInit(p7, sarg->out);
+               sarg->ndef_bio = PKCS7_dataInit(*pp7, sarg->out);
                if (!sarg->ndef_bio)
                        return 0;
                break;
 
                case ASN1_OP_STREAM_POST:
                case ASN1_OP_DETACHED_POST:
-               if (PKCS7_dataFinal(p7, sarg->ndef_bio) <= 0)
+               if (PKCS7_dataFinal(*pp7, sarg->ndef_bio) <= 0)
                        return 0;
                break;