summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2013-04-04 14:44:55 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-04-05 14:43:29 +0300
commit76e55a900a75cc7ec19c16c9964171110fc6a4f1 (patch)
tree9577487ba6b95354590fdcea4bf7556446a7f57d /src
parent4c1f7677fbccabcfc4188f4175912a8204e1c174 (diff)
downloadconnman-76e55a900a75cc7ec19c16c9964171110fc6a4f1.tar.gz
connman-76e55a900a75cc7ec19c16c9964171110fc6a4f1.tar.bz2
connman-76e55a900a75cc7ec19c16c9964171110fc6a4f1.zip
dnsproxy: Fix memory leak when request timeouts
Diffstat (limited to 'src')
-rw-r--r--src/dnsproxy.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 9bea3b1c..04b4c791 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -490,6 +490,17 @@ static int get_req_udp_socket(struct request_data *req)
return g_io_channel_unix_get_fd(channel);
}
+static void destroy_request_data(struct request_data *req)
+{
+ if (req->timeout > 0)
+ g_source_remove(req->timeout);
+
+ g_free(req->resp);
+ g_free(req->request);
+ g_free(req->name);
+ g_free(req);
+}
+
static gboolean request_timeout(gpointer user_data)
{
struct request_data *req = user_data;
@@ -536,8 +547,8 @@ static gboolean request_timeout(gpointer user_data)
}
}
- g_free(req->resp);
- g_free(req);
+ req->timeout = 0;
+ destroy_request_data(req);
return FALSE;
}
@@ -1605,17 +1616,6 @@ static int ns_resolv(struct server_data *server, struct request_data *req,
return 0;
}
-static void destroy_request_data(struct request_data *req)
-{
- if (req->timeout > 0)
- g_source_remove(req->timeout);
-
- g_free(req->resp);
- g_free(req->request);
- g_free(req->name);
- g_free(req);
-}
-
static int forward_dns_reply(unsigned char *reply, int reply_len, int protocol,
struct server_data *data)
{