Copilot commented on code in PR #12639:
URL: https://github.com/apache/trafficserver/pull/12639#discussion_r2494994612


##########
doc/admin-guide/files/records.yaml.en.rst:
##########
@@ -2573,6 +2573,23 @@ Cache Control
    :units: millisecond
 
    How long to wait between each write cycle when syncing the cache directory 
to disk.

Review Comment:
   Missing blank line between the end of the previous configuration entry and 
the new `ts:cv` directive. RST documentation typically requires a blank line 
before directive blocks for proper formatting.
   ```suggestion
      How long to wait between each write cycle when syncing the cache 
directory to disk.
   ```



##########
src/iocore/cache/P_CacheDir.h:
##########
@@ -246,10 +248,29 @@ struct CacheSync : public Continuation {
   AIOCallback io;
   Event      *trigger    = nullptr;
   ink_hrtime  start_time = 0;
-  int         mainEvent(int event, Event *e);
-  void        aio_write(int fd, char *b, int n, off_t o);
+
+  std::vector<int> stripe_indices;
+  int              current_index{0};
+
+  int  mainEvent(int event, Event *e);
+  void aio_write(int fd, char *b, int n, off_t o);
 
   CacheSync() : Continuation(new_ProxyMutex()) { 
SET_HANDLER(&CacheSync::mainEvent); }
+
+  ~CacheSync()
+  {
+    if (trigger) {
+      trigger->cancel_action();
+      trigger = nullptr;
+    }
+    if (buf) {
+      if (buf_huge) {
+        ats_free_hugepage(buf, buflen);
+      } else {
+        ats_free(buf);
+      }

Review Comment:
   The destructor doesn't reset `buf` to nullptr, `buflen` to 0, or `buf_huge` 
to false after freeing memory. While not strictly necessary in a destructor, 
this creates inconsistency with the pattern used in the mainEvent method (lines 
995-997) where these fields are explicitly reset after freeing.
   ```suggestion
         }
         buf = nullptr;
         buflen = 0;
         buf_huge = false;
   ```



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