Yes cloned events must be destroyed for sure.

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.



On Tue, Jun 29, 2010 at 10:03 PM, Paul Li <[email protected]> wrote:

> 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:
>
> static void my_event_handler(switch_event_t *event)
> {
>     switch_event_t *clone = NULL;
>
>    if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
>
>        /* use clone in my extended context */
>
>        switch_event_destroy(&clone);
>    }
> }
>
> > Anthony Minessale
> > Tue Jun 29 12:30:52 PDT 2010
> >
> > yes any functions that take pointers to pointers and leave you with null
> > will indicate you don't have to do anything.
> >
>
>
> _______________________________________________
> FreeSWITCH-dev mailing list
> [email protected]
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>


-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:[email protected] <msn%[email protected]>
GTALK/JABBER/PAYPAL:[email protected]<paypal%[email protected]>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:[email protected] <sip%[email protected]>
googletalk:[email protected]<googletalk%3aconf%[email protected]>
pstn:+19193869900
_______________________________________________
FreeSWITCH-dev mailing list
[email protected]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org

Reply via email to