Free the IO channel if connection to the DNS server fails
authorLeena Gunda <leena.gunda@wipro.com>
Fri, 31 Dec 2010 11:20:52 +0000 (16:50 +0530)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 31 Dec 2010 18:13:28 +0000 (10:13 -0800)
Fixes BMC#11878

plugins/dnsproxy.c

index 5ce6429..60b7a39 100644 (file)
@@ -769,11 +769,14 @@ static struct server_data *create_server(const char *interface,
                        GList *list;
 
                        connman_error("Failed to connect to server %s", server);
-                       close(sk);
                        if (data->watch > 0)
                                g_source_remove(data->watch);
                        if (data->timeout > 0)
                                g_source_remove(data->timeout);
+
+                       g_io_channel_unref(data->channel);
+                       close(sk);
+
                        g_free(data->server);
                        g_free(data->interface);
                        for (list = data->domains; list; list = list->next) {