Hi Aymeric
Thanks for response , I tried multiple things and I find issue one or other (either crash or memory leak).
I am trying to do register and un-register in a continuous loop.
Something like
#define MAX_OP_COUNT 10
1. initialize osip
2. while (index < MAX_OP_COUNT)
{
register();
unregister();
}
2. release osip
And here is the summary of my test code.
osip_t *osip;
osip_transaction_t *transaction = NULL;
osip_message_t *msg = NULL;
osip_event_t *sipevent;
osip_init (&osip);
set_my_osip_callbacks(osip); //Here I set all callbacks
msg = create_my_reg_message(); //here I create a register message and adds the headers
osip_transaction_init(&transaction, NICT, osip_instance , msg);
osip_transaction_set_your_instance(transaction, my_context);
sipevent = osip_new_outgoing_sipmessage (msg);
sipevent->transactionid = transaction->transactionid;
osip_message_force_update(msg);
osip_transaction_add_event (transaction, sipevent);
Here is my callback function
void my_kill_transaction_callback(int type, osip_transaction_t *trans)
{
osip_t *osip;
my_context = osip_transaction_get_your_instance(trans);
osip = my_context->osip;
osip_remove_transaction (instance->osip, trans);
//osip_transaction_free2(trans);
//osip_transaction_free(trans);
}
In above callback function, If I call only osip_remove_transaction, the registration / un-registration everything goes fine, but with valgrind I can find lot of memory leaks. Also I tried to run it for longer time and find system memory foes down.
In above callback, If I call osip_transaction_free2 + osip_remove_transaction (which is appropriate), I face crash issue.
In above callback, If I call osip_transaction_free (osip_remove_transaction api not called), I face crash issue.
Can you please tell if my approach is correct, or do I need to do something extra.
Best Regards
Austin