> 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.
>
I see your point and I agree it is a stupid suggestion :-)
But still. why does the code below then fail:
...
....
X509_NAME_ENTRY *pX509NameEntry = NULL;
X509_REQ *pRequest = X509_REQ_new();
X509_NAME *pX509Name = X509_NAME_new();
// Setup Country
X509_NAME_ENTRY_create_by_NID(&pX509NameEntry, NID_countryName,
V_ASN1_PRINTABLESTRING, (unsigned char *) "DK", 2);
X509_NAME_add_entry(pX509Name, pX509NameEntry, 1, 1);
X509_NAME_ENTRY_free(pX509NameEntry);
// Setup Organisation
X509_NAME_ENTRY_create_by_NID(&pX509NameEntry,
NID_organizationName,V_ASN1_PRINTABLESTRING,(unsigned char *) "ACME", 4);
The call above cause an access violation. Why ???
If I set pX509NameEntry=NULL before I make the call I have no problems.
TIA
Kim Hellan
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]