Menu

#126 Memory leak in Sofia-sip

SIPit17
open
None (1)
1
2018-10-05
2018-10-05
No

Hello,
Recently I am using sofia sip library for handling subscribe messages.I found a memory leak regarding this.Below is the simple code snippet of mine.We receive every Event from this call back function.

static void EventCallBack(nua_event_t   event  ,
                int           status ,
                char const   * phrase ,
                nua_t        * nua ,
                void * Object,
                nua_handle_t * nh ,
                nua_hmagic_t * hmagic ,
                sip_t const  *sip ,
                tagi_t        tags[]) {

    switch(event) {

        case nua_i_subscribe:

                       sofia_dispatch_event_t *de = (sofia_dispatch_event_t *)malloc(sizeof(sofia_dispatch_event_t));

                        memset(de, 0, sizeof(*de));
                        nua_save_event(nua, de->event);
                        de->nh = nua_handle_ref(nh);
                        de->data = nua_event_data(de->event);

                       nua_respond((nua_handle_t *)nh, SIP_200_OK , NUTAG_WITH_THIS_MSG(de->data->e_msg), SIPTAG_CONTACT_STR(cContact.c_str()), TAG_END());

                       free(de);
                        nua_handle_destroy((nua_handle_t *)nh);
    }
}

this simple code snippet making memory leak...I think i am destroying the event perfectly.

Thank you

Discussion


Log in to post a comment.