<div dir="ltr">I replace the x509.c file.<div><br></div><div>Fixed memory leak when signing.<br></div><div><br></div><div style>But not when verify. I'll check the code.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Jun 3, 2013 at 12:08 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">
<div dir="auto"><div>Yeah, you need to first build the ate all. Can you just apply the diff on top of the 1.2.9?<br><br><div><br></div>-- <span>Aleksey</span><div><div><br></div></div></div><div><div class="h5"><div><br>On Jun 3, 2013, at 7:53 AM, Alexwell Sandro <<a href="mailto:alexwellll@gmail.com" target="_blank">alexwellll@gmail.com</a>> wrote:<br>
<br></div><blockquote type="cite"><div><div dir="ltr"><div>I compiled the version xmlsec1-1.2.19 with "no problem".</div><div><br></div><div>But this <<a href="https://git.gnome.org/browse/xmlsec/commit/?id=46896def4dfe16b16131869b03db000314413e25" target="_blank">fix memory leak in converting cert subject</a>>, I can not compile.</div>
<div><br></div><div><b>Result:</b></div><div>base64.c</div><div>..\include\xmlsec/xmlsec.h(20) : fatal error C1083: Cannot open include file: 'xmlsec/version.h': No such file or directory bn.c</div><div>
<div>..\include\xmlsec/xmlsec.h(20) : fatal error C1083: Cannot open include file: 'xmlsec/version.h': No such file or directory buffer.c</div></div><div>...</div><div><br></div></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Mon, Jun 3, 2013 at 11:40 AM, Alexwell Sandro <span dir="ltr"><<a href="mailto:alexwellll@gmail.com" target="_blank">alexwellll@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Of course, thanks!<br><div><div><br></div></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><br></span></div></div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">
On Mon, Jun 3, 2013 at 11:33 AM, 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 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>
<div><br>
On 6/3/13 7:00 AM, Alexwell Sandro wrote:<br>
> I found memory leak with xmlSecTmplX509DataAddSubjectName function.<br>
><br>
> I used example from: Signing a dynamicaly created template. sign2.c.<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>
</div>> *To generate template:*<br>
<div>> (...)<br>
> xmlNodePtr keyInfoNode = xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);<br>
> xmlNodePtr x509DataNode = xmlSecTmplKeyInfoAddX509Data(keyInfoNode);<br>
> xmlSecTmplX509DataAddSubjectName(x509DataNode);<br>
> xmlSecTmplX509DataAddCertificate(x509DataNode);<br>
> (...)<br>
><br>
</div>> *Result:*<br>
<div>> (...)<br>
> <ds:KeyInfo><br>
> <ds:X509Data><br>
> <ds:X509SubjectName/><br>
> <ds:X509Certificate/><br>
> </ds:X509Data><br>
> </ds:KeyInfo><br>
> (...)<br>
><br>
</div>> *When sign the template occurs memory leak.*<br>
<div>><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>
</div>> *When I remove "xmlSecTmplX509DataAddSubjectName"*<br>
<div>> xmlNodePtr keyInfoNode = xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);<br>
> xmlNodePtr x509DataNode = xmlSecTmplKeyInfoAddX509Data(keyInfoNode);<br>
</div>> /// xmlSecTmplX509DataAddSubjectName(x509DataNode);/<br>
<div>> xmlSecTmplX509DataAddCertificate(x509DataNode);<br>
><br>
> No memory leak detected!<br>
><br>
</div>> *The same problem when verify the signature.*<br>
<div>> With <ds:X509SubjectName> Two Memory Leaks.<br>
><br>
> Data:<br>
> 43 4E 3D 41 4C <a href="tel:45%2058%2020%20%C2%A0%20%C2%A053%2041" value="+554558205341" target="_blank">45 58 20 53 41</a> 4E 44 52 4F 20 44 CN=ALEX. S<br>
> ...<br>
><br>
> Data:<br>
> 43 4E 3D 41 4C <a href="tel:45%2058%2020%20%C2%A0%20%C2%A053%2041" value="+554558205341" target="_blank">45 58 20 53 41</a> 4E 44 52 4F 20 44 CN=ALEX. S<br>
> ...<br>
><br>
</div>> *Without <ds:X509SubjectName> No Memory Leak.*<br>
><br>
> *Another detail, when I use:*<br>
<div>> xmlNodePtr keyInfoNode = xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);<br>
> xmlNodePtr x509DataNode = xmlSecTmplKeyInfoAddX509Data(keyInfoNode);<br>
><br>
</div>> *result:*<br>
> <KeyInfo><br>
> <X509Data><br>
> <X509Certificate>MIIE3zCCA8e...<br>
><br>
> *When I use:*<br>
<div>> xmlNodePtr keyInfoNode = xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);<br>
> xmlNodePtr x509DataNode = xmlSecTmplKeyInfoAddX509Data(keyInfoNode);<br>
> xmlSecTmplX509DataAddCertificate(x509DataNode);<br>
><br>
</div>> *result with breakline:*<br>
> <KeyInfo><br>
> <X509Data><br>
><br>
> <X509Certificate>MIIE3zCCA8e...<br>
><br>
> *When I use:*<br>
<div>> xmlNodePtr x509DataNode = xmlSecTmplKeyInfoAddX509Data(keyInfoNode);<br>
> xmlSecTmplX509DataAddSubjectName(x509DataNode);<br>
><br>
</div>> *result with breakline:*<br>
> <X509Data><br>
><br>
> <X509SubjectName>CN=ALEX...<br>
><br>
> *How to fix the memory leak?*<br>
<div><div>><br>
> tags: windows 7 64 bits, visual studio 2010.<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></blockquote></div></div><blockquote type="cite"><div><span>_______________________________________________</span><br><span>xmlsec mailing list</span><br><span><a href="mailto:xmlsec@aleksey.com" target="_blank">xmlsec@aleksey.com</a></span><br>
<span><a href="http://www.aleksey.com/mailman/listinfo/xmlsec" target="_blank">http://www.aleksey.com/mailman/listinfo/xmlsec</a></span><br></div></blockquote></div></blockquote></div><br></div>