On Tue, Nov 16, 1999 at 04:28:35PM +0100, [EMAIL PROTECTED] wrote:
> Can anyone see what is wrong with the code below?
> Unless I specifically set pX509NameEntry = NULL after every call to
> X509_NAME_ENTRY_free(pX509NameEntry), I get an access violation in
> libeay32.dll when I do the next call to X509_NAME_ENTRY_create_by_NID(...).
> 
> Shouldn't X509_NAME_ENTRY_free(...) set the X509_NAME_ENTRY pointer to NULL
> after it has released the memory?

Well, it cannot do that for you.
X509_NAME_ENTRY_free() receives the pointer and has write access to change
the place to which the pointer is pointing, it however cannot manipulate
the pointer itself, which is defined in the calling function.
This would only be possible, if the call would be by reference:
        X509_NAME_ENTRY_free(&pX509NameEntry);
The OpenSSL way is however consistent with free() fclose() and a lot of other
similar routines, where you of course have to take care of your pointers
yourself.

Regards,
        Lutz
-- 
Lutz Jaenicke                             [EMAIL PROTECTED]
BTU Cottbus               http://www.aet.TU-Cottbus.DE/personen/jaenicke/
Lehrstuhl Allgemeine Elektrotechnik                  Tel. +49 355 69-4129
Universitaetsplatz 3-4, D-03044 Cottbus              Fax. +49 355 69-4153
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to