ywkaras commented on code in PR #10961:
URL: https://github.com/apache/trafficserver/pull/10961#discussion_r1446579784


##########
src/proxy/hdrs/HdrHeap.cc:
##########
@@ -1168,12 +1178,9 @@ HdrStrHeap::free()
 char *
 HdrStrHeap::allocate(int nbytes)
 {
-  char *new_space;
-
-  if (m_free_size >= static_cast<unsigned>(nbytes)) {
-    new_space     = m_free_start;
-    m_free_start += nbytes;
-    m_free_size  -= nbytes;
+  if (_avail_size >= static_cast<unsigned>(nbytes)) {
+    char *new_space  = reinterpret_cast<char *>(this) + _total_size - 
_avail_size;

Review Comment:
   The checking is already present, on line 1181.  It results in a nullptr 
return if the checking fails.  The only place this function is called is in 
HdrHeap::allocate_str(), which does handle the null return value.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to