fd_removed_cb is called by libusb_exit() -> usbi_io_exit() -> usbi_remove_poolfd() -> ctx->fd_removed_cb.
fd_removed_cb uses context->gio_channels and context->channel_list_lock.
So, you should not free and destroy it before calling libusb_exit().
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I5fdde607d19be9e4df9214489f91e3d33f41eaf6
fd = g_io_channel_unix_get_fd(ch->ch);
g_source_remove(ch->source_tag);
g_io_channel_unref(ch->ch);
+ context->gio_channels = g_list_delete_link(context->gio_channels, l);
l = next;
free(ch);
_I("removed fd %d", fd);
}
+ libusb_exit(context->lusb_ctx);
g_list_free(context->gio_channels);
pthread_mutex_destroy(&context->channel_list_lock);
- libusb_exit(context->lusb_ctx);
free(context);
return USB_HOST_ERROR_NONE;