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

hammer: mon: fix memory leak in prepare_beacon #10238

Merged
merged 1 commit into from Nov 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/mon/MDSMonitor.cc
Expand Up @@ -432,6 +432,7 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m)
// Ignore beacons if filesystem is disabled
if (!mdsmap.get_enabled()) {
dout(1) << "warning, MDS " << m->get_orig_source_inst() << " up but filesystem disabled" << dendl;
m->put();
return false;
}

Expand Down Expand Up @@ -501,6 +502,7 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m)
dout(0) << "got beacon for MDS in STATE_STOPPING, ignoring requested state change"
<< dendl;
_note_beacon(m);
m->put();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this put should be here when return 'true', because we can go into propose_pending() from dispatch() in mon/PaxosService.cc. I'm not so familiar with MDS monitor code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepare_update() is responsible to free the message before returns. so this change is correct.

return true;
}

Expand Down