Unref GIOChannel in g_at_chat_new_from_tty
authorZhenhua Zhang <zhenhua.zhang@intel.com>
Wed, 23 Sep 2009 10:57:17 +0000 (18:57 +0800)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 24 Sep 2009 17:01:54 +0000 (10:01 -0700)
gatchat/gatchat.c

index 5b3a214..8407338 100644 (file)
@@ -984,6 +984,7 @@ GAtChat *g_at_chat_new_from_tty(const char *device, GAtSyntax *syntax)
 {
        GIOChannel *channel;
        int fd;
+       GAtChat *chat;
 
        fd = open_device(device);
        if (fd < 0)
@@ -995,7 +996,9 @@ GAtChat *g_at_chat_new_from_tty(const char *device, GAtSyntax *syntax)
                return NULL;
        }
 
-       return g_at_chat_new(channel, syntax);
+       chat = g_at_chat_new(channel, syntax);
+       g_io_channel_unref(channel);
+       return chat;
 }
 
 GAtChat *g_at_chat_ref(GAtChat *chat)