Hi,

I'm doing following code:

int main(int argc, char* argv[])
{
        BYTE* pData = 0;
        size_t nSize = 0;       

        FILE* fp = fopen("d:\\certcrl.crl", "rb");
        if(fp)
        {
                fseek(fp, 0, SEEK_END) ;
                nSize = ftell(fp);
                fseek(fp, 0, SEEK_SET);
                pData = new BYTE[nSize];
                fread(pData, sizeof(BYTE), nSize, fp);
                BIO* pBio = BIO_new(BIO_s_mem());
                BIO_write(pBio, pData, nSize);
                X509_CRL* pX509Crl = d2i_X509_CRL_bio(pBio, 0);
                BIO_free(pBio);
                delete[] pData;
                fclose(fp);
                if(pX509Crl)
                        X509_CRL_free(pX509Crl);
        }

        EVP_cleanup(); 

        return 0;
}


And I'm getting a memory leak, with following function call stack:
CRYPTO_malloc()         in .\crypto\mem.c
ERR_get_state() in .\crypto\err.c
ERR_clear_error()       in .\crypto\err.c       
ASN1_d2i_bio()          in .\crypto\asn1\a_d2i_fp.c     
d2iX509_CRL_bio()       in .\crypto\x509\x_all.c
main()                  
mainCRTStartup()


Can any one tell me why we is ERR_clear_error have following body in which
the pointer ERR_STATE is never deleted:
 void ERR_clear_error(void)
        {
        int i;
        ERR_STATE *es;

        es=ERR_get_state();

        for (i=0; i<ERR_NUM_ERRORS; i++)
                {
                es->err_buffer[i]=0;
                err_clear_data(es,i);
                es->err_file[i]=NULL;
                es->err_line[i]= -1;
                }
        es->top=es->bottom=0;
        }

Or its BUG..

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

Reply via email to