Fix Test Code Leak on Failure
@@ -198,11 +198,14 @@ PingConnectionShutdown(
)
{
auto ConnState = (PingConnState*)Connection->Context;
- if (ConnState->GetPingStats()->ExpectedCloseStatus == QUIC_STATUS_SUCCESS) {
+ auto ExpectedSuccess =
+ ConnState->GetPingStats()->ExpectedCloseStatus == QUIC_STATUS_SUCCESS;
+ delete ConnState;
+
+ if (ExpectedSuccess) {
TEST_FALSE(Connection->GetTransportClosed());
TEST_FALSE(Connection->GetPeerClosed());
}
- delete ConnState;
}
_Function_class_(NEW_STREAM_CALLBACK)
