This is another example of the problem I highlighted a few days ago. You need to be very careful with which getter methods return a new instance (or inc the ref count), and which ones do not.

Definitely not a bug but a matter of consistency.

Nils Larsch wrote:
Alexandre Belloni wrote:

Hi,

I'm trying to build a PKCS7 envelopped data (encrypted) but when I'm done withe the PKCS7 structure and I try to free it (calling PKCS7_free) I keep getting an "access violation accessing 0xfeeefef6".

I'm using openssl 0.9.8 under windows XP (win32).

Code is attached.

...

    cert = PKCS7_cert_from_signer_info(p7, si);
    if (cert == NULL)
    {
        ret = -1;
        goto err;
    }

...

    if (cert != NULL)
        X509_free(cert);

    if (p7 != NULL)
        PKCS7_free(p7);


this doesn't work as PKCS7_cert_from_signer_info doesn't
increase the reference counter and hence you free the cert
twice ...

Nils
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to