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 02:29:42 +0000 (20:29 -0600)
commit3789c2b23a4a485c66215ed88c186b6564ee8f4c
tree0ceb271f6f90faf04550743a7a70e671ab5f6046
parentb13a601e5a8f58cb5591e7897271f20265e1ee39
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