Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delete properly to avoid memory leak #350

Merged
merged 5 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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