<div>Yes cloned events must be destroyed for sure.</div><div><br></div>Better still what you should so in this case is use a fifo to deliver the cloned event to another thread so you are not blocking in the event handler.  You can then destroy it from there.<div>
<br><div><br><div><br><div class="gmail_quote">On Tue, Jun 29, 2010 at 10:03 PM, Paul Li <span dir="ltr">&lt;<a href="mailto:plite2012@gmail.com">plite2012@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I guess you were assuming I would pass the event clone (pointer) to the core API (such as switch_event_fire), so that I would not need to free the clone pointer. I guess I still need to destroy it in the following scenario:<br>

<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">static void my_event_handler(switch_event_t *event)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">{</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    switch_event_t *clone = NULL;</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    if (switch_event_dup(&amp;clone, event) == SWITCH_STATUS_SUCCESS) {</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">        </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        /* use clone in my extended context */</span><br style="font-family:courier new,monospace">

<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">       switch_event_destroy(&amp;clone);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">}</span><br><br>&gt; Anthony Minessale<br>&gt; Tue Jun 29 12:30:52 PDT 2010<br>&gt;<br>&gt; yes any functions that take pointers to pointers and leave you with null<br>&gt; will indicate you don&#39;t have to do anything.<br>

&gt;<br><br>
<br>_______________________________________________<br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:+19193869900<br>
</div></div></div>