frontend.c: Fix possible crash when freeing an IO channel

Thanks to Michael Terry <mterry@ubuntu.com> for the bug report and fix.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>