zwoop commented on code in PR #13159:
URL: https://github.com/apache/trafficserver/pull/13159#discussion_r3237225050
##########
src/iocore/aio/unit_tests/test_AIOCallback.cc:
##########
@@ -84,11 +87,11 @@ struct DeletionTrackedAIOCallback : AIOCallback {
} // namespace
-TEST_CASE("AIOCallback completion tolerates owner deletion", "[iocore][aio]")
+TEST_CASE("AIOCallback completion tolerates callback deletion",
"[iocore][aio]")
{
- bool completed = false;
- auto owner = new AIOCompletionOwner(completed);
- auto callback = &owner->callback;
+ bool completed = false;
+ AIOCompletionOwner owner(completed);
+ auto *callback = owner.callback.get();
// Without ASan, a broken implementation can still pass because the stale
value of from_ts_api is typically false.
CHECK(callback->io_complete(EVENT_NONE, nullptr) == EVENT_DONE);
Review Comment:
Not important, but after completing this, I think callback is in an
undefined state. We don't use it after this, but maybe we should NULL it out or
something ?
##########
src/iocore/aio/unit_tests/test_AIOCallback.cc:
##########
@@ -84,11 +87,11 @@ struct DeletionTrackedAIOCallback : AIOCallback {
} // namespace
-TEST_CASE("AIOCallback completion tolerates owner deletion", "[iocore][aio]")
+TEST_CASE("AIOCallback completion tolerates callback deletion",
"[iocore][aio]")
{
- bool completed = false;
- auto owner = new AIOCompletionOwner(completed);
- auto callback = &owner->callback;
+ bool completed = false;
+ AIOCompletionOwner owner(completed);
+ auto *callback = owner.callback.get();
// Without ASan, a broken implementation can still pass because the stale
value of from_ts_api is typically false.
CHECK(callback->io_complete(EVENT_NONE, nullptr) == EVENT_DONE);
Review Comment:
Not important, but after completing this, I think callback is in an
undefined state. We don't use it after this, but maybe we should NULL it out or
something ? In case someone looks at this after we retire.
--
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]