Skip to content

Commit

Permalink
Merge pull request #350 from sfc-aqua/fix-messages-delete
Browse files Browse the repository at this point in the history
Add delete properly to avoid memory leak
  • Loading branch information
zigen authored Jan 17, 2022
2 parents 6e2a7e3 + dbee19a commit bb1c403
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion quisp/modules/Application/Application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ ConnectionSetupRequest *Application::createConnectionSetupRequest(int dest_addr,
*/
void Application::handleMessage(cMessage *msg) {
if (dynamic_cast<deleteThisModule *>(msg)) {
deleteModule();
delete msg;
deleteModule();
return;
}

Expand Down
4 changes: 3 additions & 1 deletion quisp/modules/QRSA/HardwareMonitor/HardwareMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,9 @@ cModule *HardwareMonitor::getQNodeWithAddress(int address) {
addr = (int)node->getModule()->par("address");
EV_DEBUG << "End node address is " << addr << "\n";
if (addr == address) {
return node->getModule();
auto *mod = node->getModule();
delete topo;
return mod;
}
}
delete topo;
Expand Down
1 change: 1 addition & 0 deletions quisp/modules/QRSA/RuleEngine/RuleEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ void RuleEngine::handleMessage(cMessage *msg) {
if (terminated_qnic[qnic_address]) {
// std::cout<<"NOT ANY MORE qnic["<<qnic_address<<"] in node["<<parentAddress<<"]";
// error("qnic should not be terminated here, Node: %d, qnic_address: %d", parentAddress, qnic_address);
delete msg;
return;
} else if (pk->getInternal_qnic_index() == -1) { // Schedule next burst. MIM, or the other node without internal HoM of MM
EV_DEBUG << "This BSA request is non-internal\n";
Expand Down

0 comments on commit bb1c403

Please sign in to comment.