[xmlsec] Memory leak in xmlSecMSCryptoAppKeysMngrCertLoadMemory

Aleksey Sanin aleksey at aleksey.com
Mon Sep 19 19:47:09 PDT 2011

Hi Satoshi,

This sounds reasonable. Do you mind creating a patch?

Thanks in advance,


On 9/19/11 11:13 AM, Satoshi Ito wrote:
> Hello,
> I noticed that xmlSecMSCryptoAppKeysMngrCertLoadMemory (v1.2.18 
> mscrypto\app.c:867 ) leaks memory on each successful call. This seems 
> to be because the PCCERT_CONTEXT constructed from the buffer is freed 
> only when xmlSecMSCryptoX509StoreAdoptCert (v1.2.18 
> mscrypto\x509vfy.c:582) fails (according to MSDN, 
> CertAddCertificateContextToStore creates a copy of the context and 
> adds the copy to the store, so the original PCCERT_CONTEXT is leaked 
> on success). I think you can safely get around this by adding 
> CertFreeCertificateContext(pCert) before the return(0) on 
> mscrypto\app.c:924, but please correct me if I'm misunderstanding 
> something.
> Sincerely,
> Satoshi Ito
> _______________________________________________
> xmlsec mailing list
> xmlsec at aleksey.com
> http://www.aleksey.com/mailman/listinfo/xmlsec

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aleksey.com/pipermail/xmlsec/attachments/20110919/cacb2732/attachment.html>

More information about the xmlsec mailing list