Copilot commented on code in PR #13645: URL: https://github.com/apache/trafficserver/pull/13645#discussion_r3946673043
########## src/proxy/logging/LogField.cc: ########## @@ -1010,15 +1010,11 @@ LogFieldList::clear() } void -LogFieldList::add(LogField *field, bool copy) +LogFieldList::add(LogField *field) Review Comment: The LogFieldList block comment above still says items are "copied by default" to enforce single-list membership, but add() no longer supports copying and always takes ownership. This comment should be updated to reflect the new ownership semantics so callers understand they must pass heap-allocated fields and not share a LogField across lists. ########## include/proxy/logging/LogField.h: ########## @@ -273,7 +273,7 @@ class LogFieldList ~LogFieldList(); void clear(); - void add(LogField *field, bool copy = true); + void add(LogField *field); void remove(LogField *field); Review Comment: LogFieldList::add() now always takes ownership of the pointer, but the header declaration doesn't document that contract. Adding a brief comment here would help prevent accidental passing of stack/static LogField instances (which would later be deleted by LogFieldList). -- 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]
