[svn] commit: r3421 - /branches/trac394/src/lib/asiolink/tcpdns.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Nov 3 08:42:10 UTC 2010


Author: jelte
Date: Wed Nov  3 08:42:10 2010
New Revision: 3421

Log:
lenbuf on stack instead of heap

Modified:
    branches/trac394/src/lib/asiolink/tcpdns.cc

Modified: branches/trac394/src/lib/asiolink/tcpdns.cc
==============================================================================
--- branches/trac394/src/lib/asiolink/tcpdns.cc (original)
+++ branches/trac394/src/lib/asiolink/tcpdns.cc Wed Nov  3 08:42:10 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 = NULL;
+    OutputBuffer lenbuf(TCP_MESSAGE_LENGTHSIZE);
 
     CORO_REENTER (this) {
         do {
@@ -162,9 +162,8 @@
         (*answer_callback_)(*io_message_, message_, respbuf_);
 
         // Set up the response, beginning with two length bytes.
-        lenbuf = new OutputBuffer(TCP_MESSAGE_LENGTHSIZE);
-        lenbuf->writeUint16(respbuf_->getLength());
-        bufs[0] = buffer(lenbuf->getData(), lenbuf->getLength());
+        lenbuf.writeUint16(respbuf_->getLength());
+        bufs[0] = buffer(lenbuf.getData(), lenbuf.getLength());
         bufs[1] = buffer(respbuf_->getData(), respbuf_->getLength());
 
         // Begin an asynchronous send, and then yield.  When the
@@ -173,7 +172,6 @@
         // 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