Hi Lizardo, On Mon, Dec 20, 2010, Anderson Lizardo wrote: > Watches must be removed with g_source_remove() otherwise they leak a > reference count to the GIOChannel and internal memory allocations. > > Also g_io_channel_set_close_on_unref() is used, so there is no need to > call g_io_channel_shutdown() by hand. You do realize that the watch gets freed and removed from the main context when the callback function returns FALSE, right? The only case for all of these patches where you'd have unfreed memory is when you stop iterating the mainloop while still having the sockets open (or even if you close them during the very last iteration), i.e. when bluetoothd is exiting. Is that the problem you're trying to fix here, i.e. getting rid of unnecessary "noise" in the valgrind leak report? Johan -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html