Commit 491ba6f2 authored by Simon Morlat's avatar Simon Morlat
Browse files

improve logging, fix potential use of already freed pointer

parent 11d67d12
......@@ -67,7 +67,12 @@ belle_sip_object_t * belle_sip_object_ref(void *obj){
void belle_sip_object_unref(void *ptr){
belle_sip_object_t *obj=BELLE_SIP_OBJECT(ptr);
if (obj->ref==-1) belle_sip_fatal("Object with name [%s] freed twice !",obj->name);
if (obj->ref==-1) {
belle_sip_error("Object [%p] freed twice !",obj);
if (obj->vptr && obj->vptr->type_name) belle_sip_error("Object type might be [%s]",obj->vptr->type_name);
belle_sip_fatal("Fatal object error encountered, aborting.");
return;
}
if (obj->ref==0 && obj->pool){
belle_sip_object_pool_remove(obj->pool,obj);
obj->ref=-1;
......
......@@ -300,10 +300,8 @@ void belle_sip_request_set_dialog(belle_sip_request_t *req, belle_sip_dialog_t *
if (dialog) belle_sip_object_ref(dialog);
if (req->dialog) {
belle_sip_object_unref(req->dialog);
req->dialog=NULL;
}
req->dialog=dialog;
}
void belle_sip_request_set_uri(belle_sip_request_t* request,belle_sip_uri_t* uri) {
......
......@@ -111,13 +111,12 @@ void belle_sip_transaction_terminate(belle_sip_transaction_t *t){
,belle_sip_request_get_method(belle_sip_transaction_get_request(t))
,t);
BELLE_SIP_OBJECT_VPTR(t,belle_sip_transaction_t)->on_terminate(t);
belle_sip_provider_set_transaction_terminated(t->provider,t);
/*remove reference to the dialog to avoid circular references*/
if (t->dialog){
belle_sip_object_unref(t->dialog);
t->dialog=NULL;
}
belle_sip_provider_set_transaction_terminated(t->provider,t);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment