Commit bfd9a69b authored by Simon Morlat's avatar Simon Morlat
Browse files

fix a memory leak when a channel is abruptly interrupted while a DNS resolution is in progress

parent 0d4ba10d
......@@ -118,7 +118,10 @@ static void belle_sip_channel_destroy(belle_sip_channel_t *obj){
obj->state_listeners=for_each_weak_unref_free(obj->state_listeners,(belle_sip_object_destroy_notify_t)channel_remove_listener,obj);
obj->full_listeners=for_each_weak_unref_free(obj->full_listeners,(belle_sip_object_destroy_notify_t)channel_remove_listener,obj);
if (obj->resolver_ctx>0) belle_sip_resolver_context_cancel(obj->resolver_ctx);
if (obj->resolver_ctx != NULL) {
belle_sip_resolver_context_cancel(obj->resolver_ctx);
belle_sip_object_unref(obj->resolver_ctx);
}
if (obj->inactivity_timer){
belle_sip_main_loop_remove_source(obj->stack->ml,obj->inactivity_timer);
belle_sip_object_unref(obj->inactivity_timer);
......@@ -1417,6 +1420,9 @@ void belle_sip_channel_resolve(belle_sip_channel_t *obj){
else
obj->resolver_ctx=belle_sip_stack_resolve_a(obj->stack, obj->peer_name, obj->peer_port, obj->ai_family, channel_res_done, obj);
if (obj->resolver_ctx){
char *name = belle_sip_strdup_printf("Channel resolver for %s", obj->peer_name);
belle_sip_object_set_name((belle_sip_object_t*)obj->resolver_ctx, name);
belle_sip_free(name);
belle_sip_object_ref(obj->resolver_ctx);
}
return ;
......
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