Skip to content

Commit

Permalink
Fix memory leak in spinquic (#4300)
Browse files Browse the repository at this point in the history
* fix memory leak in spinquic

* use struct

* remove Datagram Tracker
  • Loading branch information
ami-GS committed May 15, 2024
1 parent 7c4f1b1 commit cc7e79d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/tools/spin/spinquic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,10 @@ QUIC_STATUS QUIC_API SpinQuicHandleStreamEvent(HQUIC Stream, void* , QUIC_STREAM

if (!ctx->Deleting && GetRandom(20) == 0) {
MsQuic.StreamShutdown(Stream, (QUIC_STREAM_SHUTDOWN_FLAGS)GetRandom(16), 0);
return QUIC_STATUS_SUCCESS;
goto Exit;
}

switch (Event->Type) {
case QUIC_STREAM_EVENT_SEND_COMPLETE:
delete (QUIC_BUFFER*)Event->SEND_COMPLETE.ClientContext;
break;
case QUIC_STREAM_EVENT_PEER_SEND_SHUTDOWN:
MsQuic.StreamShutdown(Stream, (QUIC_STREAM_SHUTDOWN_FLAGS)GetRandom(16), 0);
break;
Expand Down Expand Up @@ -436,6 +433,11 @@ QUIC_STATUS QUIC_API SpinQuicHandleStreamEvent(HQUIC Stream, void* , QUIC_STREAM
break;
}

Exit:
if (Event->Type == QUIC_STREAM_EVENT_SEND_COMPLETE) {
delete (QUIC_BUFFER*)Event->SEND_COMPLETE.ClientContext;
}

return QUIC_STATUS_SUCCESS;
}

Expand Down

0 comments on commit cc7e79d

Please sign in to comment.