crimson::osd::PG::send_cluster_message() accepts a `Message*`
pointer, and then hand it over to `shard_services.send_to_osd()`,
which expects a `Ref<Message>`. so the raw pointer is used to
construct an `intrusive_ptr<Message>`, which increment the
refcount of that Message instance by one. but that Message
was owned by nobody before that, so we end up with an
`intrusive_ptr<Message>` of 2 refcount, and only a single
owner. hence the memory leak.
in this change, instructs the constructor to not add the refcount.
Signed-off-by: Kefu Chai <kchai@redhat.com>
void send_cluster_message(
int osd, Message *m,
epoch_t epoch, bool share_map_update=false) final {
- (void)shard_services.send_to_osd(osd, m, epoch);
+ (void)shard_services.send_to_osd(osd, MessageRef{m, false}, epoch);
}
void send_pg_created(pg_t pgid) final {