zizhong commented on a change in pull request #6858:
URL: https://github.com/apache/trafficserver/pull/6858#discussion_r437826541



##########
File path: iocore/hostdb/I_HostDBProcessor.h
##########
@@ -146,16 +146,17 @@ struct HostDBInfo : public RefCountObj {
     ink_release_assert(iobuffer_index >= 0);
     void *ptr = ioBufAllocator[iobuffer_index].alloc_void();
     memset(ptr, 0, size);
-    HostDBInfo *ret     = new (ptr) HostDBInfo();
-    ret->iobuffer_index = iobuffer_index;
+    HostDBInfo *ret      = new (ptr) HostDBInfo();
+    ret->_iobuffer_index = iobuffer_index;
     return ret;
   }
 
   void
   free() override
   {
-    Debug("hostdb", "freeing %d bytes at [%p]", (1 << (7 + iobuffer_index)), 
this);
-    ioBufAllocator[iobuffer_index].free_void((void *)(this));
+    ink_release_assert(from_alloc());

Review comment:
       Looks like, the diff introduces new ink_release_assert to make sure the 
object is allocated from HostDBInfo::alloc().
   Could we simply the object uncopyable to achieve the same?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to