<div dir="ltr">Solved the problem.<div><br></div><div>No memory leak!<br><div><br></div><div style>Thanks!</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 3, 2013 at 12:32 PM, Aleksey Sanin <span dir="ltr"><<a href="mailto:aleksey@aleksey.com" target="_blank">aleksey@aleksey.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Good. And one more<br>
<br>
<a href="https://git.gnome.org/browse/xmlsec/commit/?id=1a53ec712152ea33e16b524833f4a9db48be43b8" target="_blank">https://git.gnome.org/browse/xmlsec/commit/?id=1a53ec712152ea33e16b524833f4a9db48be43b8</a><br>
<br>
Could you please try it?<br>
<br>
Aleksey<br>
<div class="im"><br>
On 6/3/13 8:25 AM, Alexwell Sandro wrote:<br>
> I replace the x509.c file.<br>
><br>
> Fixed memory leak when signing.<br>
><br>
> But not when verify. I'll check the code.<br>
><br>
><br>
> On Mon, Jun 3, 2013 at 12:08 PM, Aleksey Sanin <<a href="mailto:aleksey@aleksey.com">aleksey@aleksey.com</a><br>
</div><div class="im">> <mailto:<a href="mailto:aleksey@aleksey.com">aleksey@aleksey.com</a>>> wrote:<br>
><br>
>     Yeah, you need to first build the ate all. Can you just apply the<br>
>     diff on top of the 1.2.9?<br>
><br>
><br>
>     -- Aleksey<br>
><br>
><br>
>     On Jun 3, 2013, at 7:53 AM, Alexwell Sandro <<a href="mailto:alexwellll@gmail.com">alexwellll@gmail.com</a><br>
</div><div class="im">>     <mailto:<a href="mailto:alexwellll@gmail.com">alexwellll@gmail.com</a>>> wrote:<br>
><br>
>>     I compiled the version xmlsec1-1.2.19 with "no problem".<br>
>><br>
>>     But this <fix memory leak in converting cert subject<br>
</div>>>     <<a href="https://git.gnome.org/browse/xmlsec/commit/?id=46896def4dfe16b16131869b03db000314413e25" target="_blank">https://git.gnome.org/browse/xmlsec/commit/?id=46896def4dfe16b16131869b03db000314413e25</a>>>,<br>

>>     I can not compile.<br>
>><br>
>>     *Result:*<br>
<div class="im">>>     base64.c<br>
>>     ..\include\xmlsec/xmlsec.h(20) : fatal error C1083: Cannot open<br>
>>     include file: 'xmlsec/version.h': No such file or directory bn.c<br>
>>     ..\include\xmlsec/xmlsec.h(20) : fatal error C1083: Cannot open<br>
>>     include file: 'xmlsec/version.h': No such file or directory buffer.c<br>
>>     ...<br>
>><br>
>><br>
>><br>
>>     On Mon, Jun 3, 2013 at 11:40 AM, Alexwell Sandro<br>
</div><div class="im">>>     <<a href="mailto:alexwellll@gmail.com">alexwellll@gmail.com</a> <mailto:<a href="mailto:alexwellll@gmail.com">alexwellll@gmail.com</a>>> wrote:<br>
>><br>
>>         Of course, thanks!<br>
>><br>
>><br>
>><br>
>><br>
>>         On Mon, Jun 3, 2013 at 11:33 AM, Aleksey Sanin<br>
</div><div><div class="h5">>>         <<a href="mailto:aleksey@aleksey.com">aleksey@aleksey.com</a> <mailto:<a href="mailto:aleksey@aleksey.com">aleksey@aleksey.com</a>>> wrote:<br>
>><br>
>>             Good catch. I think I found it<br>
>><br>
>>             <a href="https://git.gnome.org/browse/xmlsec/commit/?id=46896def4dfe16b16131869b03db000314413e25" target="_blank">https://git.gnome.org/browse/xmlsec/commit/?id=46896def4dfe16b16131869b03db000314413e25</a><br>

>><br>
>>             Can you try it? I don't have windows env these days.<br>
>><br>
>>             Aleksey<br>
>><br>
>>             On 6/3/13 7:00 AM, Alexwell Sandro wrote:<br>
>>             > I found memory leak with<br>
>>             xmlSecTmplX509DataAddSubjectName function.<br>
>>             ><br>
>>             > I used example from: Signing a dynamicaly created<br>
>>             template. sign2.c.<br>
>>             ><br>
>>              <<a href="http://www.aleksey.com/xmlsec/api/xmlsec-examples-sign-dynamimc-template.html" target="_blank">http://www.aleksey.com/xmlsec/api/xmlsec-examples-sign-dynamimc-template.html</a>><br>
>>             ><br>
>>             > *To generate template:*<br>
>>             > (...)<br>
>>             > xmlNodePtr keyInfoNode =<br>
>>             xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);<br>
>>             > xmlNodePtr x509DataNode =<br>
>>             xmlSecTmplKeyInfoAddX509Data(keyInfoNode);<br>
>>             > xmlSecTmplX509DataAddSubjectName(x509DataNode);<br>
>>             > xmlSecTmplX509DataAddCertificate(x509DataNode);<br>
>>             > (...)<br>
>>             ><br>
>>             > *Result:*<br>
>>             > (...)<br>
>>             > <ds:KeyInfo><br>
>>             > <ds:X509Data><br>
>>             > <ds:X509SubjectName/><br>
>>             > <ds:X509Certificate/><br>
>>             > </ds:X509Data><br>
>>             > </ds:KeyInfo><br>
>>             > (...)<br>
>>             ><br>
>>             > *When sign the template occurs memory leak.*<br>
>>             ><br>
>>             > Data:<br>
>>             >     43 00 4E 00    3D 00 41 00    4C 00 45 00    58 00 20 00<br>
>>             > C.N.=.A. L.E.X...<br>
>>             > ...<br>
>>             ><br>
>>             > *When I remove "xmlSecTmplX509DataAddSubjectName"*<br>
>>             > xmlNodePtr keyInfoNode =<br>
>>             xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);<br>
>>             > xmlNodePtr x509DataNode =<br>
>>             xmlSecTmplKeyInfoAddX509Data(keyInfoNode);<br>
>>             > /// xmlSecTmplX509DataAddSubjectName(x509DataNode);/<br>
>>             > xmlSecTmplX509DataAddCertificate(x509DataNode);<br>
>>             ><br>
>>             > No memory leak detected!<br>
>>             ><br>
>>             > *The same problem when verify the signature.*<br>
>>             > With <ds:X509SubjectName> Two Memory Leaks.<br>
>>             ><br>
>>             >  Data:<br>
>>             >     43 4E 3D 41    4C 45 58 20    53 41<br>
</div></div>>>             <tel:45%2058%2020%20%C2%A0%20%C2%A053%2041> 4E 44    52 4F<br>
<div class="im">>>             20 44     CN=ALEX. S<br>
>>             > ...<br>
>>             ><br>
>>             >  Data:<br>
>>             >     43 4E 3D 41    4C 45 58 20    53 41<br>
</div>>>             <tel:45%2058%2020%20%C2%A0%20%C2%A053%2041> 4E 44    52 4F<br>
<div><div class="h5">>>             20 44     CN=ALEX. S<br>
>>             > ...<br>
>>             ><br>
>>             > *Without  <ds:X509SubjectName> No Memory Leak.*<br>
>>             ><br>
>>             > *Another detail, when I use:*<br>
>>             > xmlNodePtr keyInfoNode =<br>
>>             xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);<br>
>>             > xmlNodePtr x509DataNode =<br>
>>             xmlSecTmplKeyInfoAddX509Data(keyInfoNode);<br>
>>             ><br>
>>             > *result:*<br>
>>             > <KeyInfo><br>
>>             > <X509Data><br>
>>             > <X509Certificate>MIIE3zCCA8e...<br>
>>             ><br>
>>             > *When I use:*<br>
>>             > xmlNodePtr keyInfoNode =<br>
>>             xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);<br>
>>             > xmlNodePtr x509DataNode =<br>
>>             xmlSecTmplKeyInfoAddX509Data(keyInfoNode);<br>
>>             > xmlSecTmplX509DataAddCertificate(x509DataNode);<br>
>>             ><br>
>>             > *result with breakline:*<br>
>>             > <KeyInfo><br>
>>             > <X509Data><br>
>>             ><br>
>>             > <X509Certificate>MIIE3zCCA8e...<br>
>>             ><br>
>>             > *When I use:*<br>
>>             > xmlNodePtr x509DataNode =<br>
>>             xmlSecTmplKeyInfoAddX509Data(keyInfoNode);<br>
>>             > xmlSecTmplX509DataAddSubjectName(x509DataNode);<br>
>>             ><br>
>>             > *result with breakline:*<br>
>>             > <X509Data><br>
>>             ><br>
>>             > <X509SubjectName>CN=ALEX...<br>
>>             ><br>
>>             > *How to fix the memory leak?*<br>
>>             ><br>
>>             > tags: windows 7 64 bits, visual studio 2010.<br>
>><br>
>><br>
>><br>
>>     _______________________________________________<br>
>>     xmlsec mailing list<br>
</div></div>>>     <a href="mailto:xmlsec@aleksey.com">xmlsec@aleksey.com</a> <mailto:<a href="mailto:xmlsec@aleksey.com">xmlsec@aleksey.com</a>><br>
>>     <a href="http://www.aleksey.com/mailman/listinfo/xmlsec" target="_blank">http://www.aleksey.com/mailman/listinfo/xmlsec</a><br>
<div class="HOEnZb"><div class="h5">><br>
><br>
><br>
><br>
> _______________________________________________<br>
> xmlsec mailing list<br>
> <a href="mailto:xmlsec@aleksey.com">xmlsec@aleksey.com</a><br>
> <a href="http://www.aleksey.com/mailman/listinfo/xmlsec" target="_blank">http://www.aleksey.com/mailman/listinfo/xmlsec</a><br>
><br>
</div></div></blockquote></div><br></div>