ywkaras commented on a change in pull request #6800:
URL: https://github.com/apache/trafficserver/pull/6800#discussion_r427416612
##########
File path: src/tscpp/api/utils_internal.cc
##########
@@ -49,6 +49,25 @@ resetTransactionHandles(Transaction &transaction, TSEvent
event)
return;
}
+void
+cleanupTransaction(Transaction &transaction, TSHttpTxn ats_txn_handle)
+{
+ delete &transaction;
+ // reset the txn arg to prevent use-after-free
+ TSUserArgSet(ats_txn_handle, TRANSACTION_STORAGE_INDEX, nullptr);
+}
+
+void
+cleanupTransactionPlugin(Plugin *plugin)
+{
+ TransactionPlugin *transaction_plugin = static_cast<TransactionPlugin
*>(plugin);
Review comment:
What if someone called GlobalPlugin::registerHook(HOOK_TXN_CLOSE) ? You
should add an assert to block that.
----------------------------------------------------------------
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]