demo: Properly clean up resources
authorAlexandru Gagniuc <mr.nuke.me@gmail.com>
Wed, 19 Dec 2012 06:49:11 +0000 (00:49 -0600)
committerAlexandru Gagniuc <mr.nuke.me@gmail.com>
Tue, 8 Jan 2013 06:42:06 +0000 (00:42 -0600)
commit0f02add0d82f4e88ce8f2f8d83dcbe958edfac48
tree1238b407ad8057cb5f6c88ddc2df234cf17b2a55
parentb51d61d217825011c6de9b7c3f433a5e35be7a77
demo: Properly clean up resources

The demo driver did not have clear_instances() or hw_cleanup properly
implemented. Valgrind showed an alarming number of "definitely lost" leaks.

Besides not cleaning up, the GIOChannels were not unref'd. They are created with
a ref count of 1. Even after calling g_io_channel_shutdown(), they need to
be unref'd for their memory to be freed.

Implement clear_instances, and unref the channels. Valgrind no longer complains
about leaks coming from demo.c.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
hardware/demo/demo.c