mgr: pass MessageRef to monc.send_mon_message()

less chance to leak memory

see also: https://tracker.ceph.com/issues/37884

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2019-09-18 12:46:09 +08:00
parent 7df36081d1
commit 12d301a199
2 changed files with 4 additions and 4 deletions

View File

@ -2356,7 +2356,7 @@ void DaemonServer::send_report()
}
}
auto m = new MMonMgrReport();
auto m = ceph::make_message<MMonMgrReport>();
py_modules.get_health_checks(&m->health_checks);
py_modules.get_progress_events(&m->progress_events);
@ -2427,7 +2427,7 @@ void DaemonServer::send_report()
// TODO? We currently do not notify the PyModules
// TODO: respect needs_send, so we send the report only if we are asked to do
// so, or the state is updated.
monc->send_mon_message(m);
monc->send_mon_message(std::move(m));
}
void DaemonServer::adjust_pgs()

View File

@ -218,7 +218,7 @@ void MgrStandby::send_beacon()
metadata["addrs"] = stringify(client_messenger->get_myaddrs());
collect_sys_info(&metadata, g_ceph_context);
MMgrBeacon *m = new MMgrBeacon(monc.get_fsid(),
auto m = ceph::make_message<MMgrBeacon>(monc.get_fsid(),
monc.get_global_id(),
g_conf()->name.get_id(),
addrs,
@ -243,7 +243,7 @@ void MgrStandby::send_beacon()
m->set_services(active_mgr->get_services());
}
monc.send_mon_message(m);
monc.send_mon_message(std::move(m));
}
void MgrStandby::tick()