Commit 915d4cb6 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

fixed two more memleaks;

I think the comment was wrong for the server_ member of UDPQuery, and we can use a shared_ptr here, as long as we clone() the DNSServer into said shared_ptr.
Other fix is deletion of the lenbuf buffer in the tcp handler

git-svn-id: svn:// e5f2f494-b856-4b98-b285-d166d9295462
parent 3d9176ff
......@@ -222,12 +222,7 @@ private:
boost::shared_array<char> data_;
// The UDP or TCP Server object from which the query originated.
// Note: Using a shared_ptr for this can cause problems when
// control is being transferred from this coroutine to the server;
// the reference count can drop to zero and cause the server to be
// destroyed before it executes. Consequently in this case it's
// safer to use a raw pointer.
DNSServer* server_;
boost::shared_ptr<DNSServer> server_;
......@@ -72,7 +72,7 @@ TCPServer::operator()(error_code ec, size_t length) {
/// a switch statement, inline variable declarations are not
/// permitted. Certain variables used below can be declared here.
boost::array<const_buffer,2> bufs;
OutputBuffer* lenbuf;
OutputBuffer* lenbuf = NULL;
do {
......@@ -173,6 +173,7 @@ TCPServer::operator()(error_code ec, size_t length) {
// will simply exit at that time).
CORO_YIELD async_write(*socket_, bufs, *this);
delete lenbuf;
/// Call the DNS lookup provider. (Expected to be called by the
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment