test-server: Fix GIOChannel leak in create_tty

Remove client_io and unref server_io after creating GAtServer.
This commit is contained in:
Zhenhua Zhang 2010-06-12 13:50:44 +08:00 committed by Denis Kenzior
parent 1822deba4a
commit 199582f684
1 changed files with 2 additions and 4 deletions

View File

@ -722,7 +722,6 @@ static gboolean create_tty(const char *modem_path)
int master, slave;
char pty_name[256];
GIOChannel *server_io;
GIOChannel *client_io;
if (!modem_path)
return FALSE;
@ -732,9 +731,6 @@ static gboolean create_tty(const char *modem_path)
set_raw_mode(slave);
client_io = g_io_channel_unix_new(slave);
g_io_channel_set_close_on_unref(client_io, TRUE);
g_print("new pty is created at %s\n", pty_name);
server_io = g_io_channel_unix_new(master);
@ -747,6 +743,8 @@ static gboolean create_tty(const char *modem_path)
return FALSE;
}
g_io_channel_unref(server_io);
return TRUE;
}