[xmlsec] [Patch] Key / Certificate loading from memory
Aleksey Sanin
aleksey@aleksey.com
Thu, 07 Aug 2003 08:26:02 -0700
> Yes, I already saw this and am currently working on it, so I can send the
> patch to you when I'm done.
Great! I see your second email too. Thanks! I'll look at the patch tonight.
>> And I am not sure I see the memory leak fix you mentioned. Which
>> function is it in?
>
> The memory leak is in "xmlSecOpenSSLAppKeyCertLoad" of src/openssl/app.c
> When the call to "xmlSecOpenSSLKeyDataX509AdoptCert" failes, an error
> gets
> returned, but the "cert" variable doesn't get freed.
I am still not sure I got it. The code right now looks like this:
.....
ret = xmlSecOpenSSLKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"xmlSecOpenSSLKeyDataX509AdoptCert",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
"data=%s",
xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
X509_free(cert);
return(-1);
}
....
The cert gets freed. I guess you are confused with diff. If you scroll
down to the very bottom
of your first patch (did not look at the second one yet) then you'll see
that original "X509_free (cert);"
line.
Aleksey