Skip to content

Commit

Permalink
merlin/linkcontrol: fix memory leak on insufficient send credits
Browse files Browse the repository at this point in the history
LinkControl::send allocates a RtrEvent to first compute the number of
flits needed to send a request. If there's not enough credits, the
method returns early without deleting the RtrEvent object and leaks its
memory. This patch deletes the object before returning to fix the leak.
  • Loading branch information
heyitsanthony committed Nov 13, 2024
1 parent c3cc90c commit 55bc053
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/sst/elements/merlin/interfaces/linkControl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,11 @@ bool LinkControl::send(SimpleNetwork::Request* req, int vn) {
int flits = ev->getSizeInFlits();

// Check to see if there are enough credits to send
if ( out_handle.credits < flits ) return false;
if ( out_handle.credits < flits ) {
ev->takeRequest();
delete ev;
return false;
}

// Update the credits
out_handle.credits -= flits;
Expand Down

0 comments on commit 55bc053

Please sign in to comment.