<div dir="ltr">glad it helped -- and sorry for previous briefness ;)<br><br>Rainer<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 16, 2013 at 5:24 PM, Champ Clark III <span dir="ltr"><<a href="mailto:cclark@quadrantsec.com" target="_blank">cclark@quadrantsec.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
<br>
</div><div class="im">> > believe me, that's the fix ;)<br>
<br>
</div>.. Yep :)<br>
<div class="im"><br>
> > The key point to understand is that ee_fmtEventToRFC5424 returns a *new* estr into the<br>
result pointer you provide (str in your case). Have a look here, and<br>
carefully look at line 156, where it is created:<br>
> ><br>
<a href="http://git.adiscon.com/?p=libee.git;a=blob;f=src/syslog_enc.c;h=d559521581242ec73a5687aae1de83ba4f2fbbe3;hb=HEAD#l150" target="_blank">http://git.adiscon.com/?p=libee.git;a=blob;f=src/syslog_enc.c;h=d559521581242ec73a5687aae1de83ba4f2fbbe3;hb=HEAD#l150</a><br>
> > So while you have just one variable, this one variable points to<br>
different objects at different points in time. So when you assign a new<br>
object to it (like you do with ee_fmtEventToRFC5424), you need to free<br>
the previous object, as you otherwise can never do that.<br>
<br>
</div>..snip..<br>
<div class="im">><br>
> > Here, you also supply the same variable to free, but each time it<br>
points to a different memory block. So no double-free.<br>
<br>
</div>Ahhh! Okay! Thank you for the explanation, that really clears it up!<br>
<div class="im"><br>
> > You must make sure that you consistently free the pervious object if you re-use a variable to<br>
point to a new object (or alternatively have a single variable for each<br>
object - one that is not being reused).<br>
><br>
> > As a side-note: things like the almost constant property name I tend<br>
to store in global variables and only create once and use the same set<br>
of variables all the time without re-creating them. Depending on what<br>
you do, this can make some performace diffrence.<br>
><br>
<br>
</div>Thanks for the tip, I'll play with it.<br>
<br>
Again.. Thank you for the help! I really appreciate it!<br>
<div class="im"><br>
<br>
<br>
- --<br>
- - Quadrant Information Security<br>
Champ Clark III<br>
</div><div class="im">-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.11 (GNU/Linux)<br>
Comment: Using GnuPG with Thunderbird - <a href="http://www.enigmail.net/" target="_blank">http://www.enigmail.net/</a><br>
<br>
</div>iQEcBAEBAgAGBQJR5WWsAAoJENnmXt7Lmc3K57cH/jS3nCvg3BeGdvgaZv4RV3PX<br>
c5Ds71DRaGK0Jjxly3+M+1qWndAjCDcxCYZSnmNZzkuTFnNJ0eDV2pkSAKqo87f4<br>
vde06oGemOIzAgUZAfSpj3ssXbpL2n8F/KAS3x8DTGwOWybtgSQxWUrM/ds7xtAV<br>
e0vepSlDjCDmr235OBwbKD4M+TYK2uD/rIGe/AwyyXk5djv8CjNZUZWwzgRha8q/<br>
aNG3M3CsqnYXn2pZBD1zlXvhFYjp0x9KdqFy11CPY6nXyWAYwG0hXJR2vz9NPUbY<br>
7Ax6sa+fqaxg2PkQSs30I4HerGEwipLYEgeDhqaiIanwFwZIw8c8R/rKpkb9++w=<br>
=AI3L<br>
<div class="HOEnZb"><div class="h5">-----END PGP SIGNATURE-----<br>
<br>
_______________________________________________<br>
Lognorm mailing list<br>
<a href="mailto:Lognorm@lists.adiscon.com">Lognorm@lists.adiscon.com</a><br>
<a href="http://lists.adiscon.net/mailman/listinfo/lognorm" target="_blank">http://lists.adiscon.net/mailman/listinfo/lognorm</a><br>
</div></div></blockquote></div><br></div>