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:26:03 +0000 (00:26 -0600)
commit562c6f4d229c113366b0976f94649a8d9f4f0103
treeb187bc33bf74cbd257e65128af86019977fbc05f
parent76b76821b707d5052f991eb93467ade14e310aa6
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