Skip to content

Commit 54c73f8

Browse files
committed
update(um): Message Deallocation
1 parent 3e40ba3 commit 54c73f8

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/plugins/core/scripting/usermessage.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,14 @@ PluginUserMessage::PluginUserMessage(std::string msgname)
8181
return;
8282

8383
this->msgid = msginfo->m_MessageId;
84-
this->msgBuffer = msg->AllocateMessage()->ToPB<google::protobuf::Message>();
84+
auto cnetmsg = msg->AllocateMessage();
85+
this->msgBuffer = cnetmsg->ToPB<google::protobuf::Message>();
86+
delete cnetmsg;
8587
this->internalMsg = msg;
8688
}
8789

8890
PluginUserMessage::~PluginUserMessage()
8991
{
90-
if (!this->internalMsg)
91-
return;
92-
if (!this->msgBuffer)
93-
return;
94-
95-
this->internalMsg->DeallocateMessage(this->msgBuffer);
9692
}
9793

9894
bool PluginUserMessage::IsValidMessage()

0 commit comments

Comments
 (0)