[svn] commit: r3419 - in /branches/trac394/src/lib/asiolink: internal/udpdns.h tcpdns.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Nov 2 14:27:46 UTC 2010


Author: jelte
Date: Tue Nov  2 14:27:46 2010
New Revision: 3419

Log:
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

Modified:
    branches/trac394/src/lib/asiolink/internal/udpdns.h
    branches/trac394/src/lib/asiolink/tcpdns.cc

Modified: branches/trac394/src/lib/asiolink/internal/udpdns.h
==============================================================================
--- branches/trac394/src/lib/asiolink/internal/udpdns.h (original)
+++ branches/trac394/src/lib/asiolink/internal/udpdns.h Tue Nov  2 14:27:46 2010
@@ -222,12 +222,7 @@
     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_;
 };
 }
 

Modified: branches/trac394/src/lib/asiolink/tcpdns.cc
==============================================================================
--- branches/trac394/src/lib/asiolink/tcpdns.cc (original)
+++ branches/trac394/src/lib/asiolink/tcpdns.cc Tue Nov  2 14:27:46 2010
@@ -72,7 +72,7 @@
     /// 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;
 
     CORO_REENTER (this) {
         do {
@@ -173,6 +173,7 @@
         // 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




More information about the bind10-changes mailing list