fixed memory leak in RsGenExchange

This commit is contained in:
csoler 2020-12-10 20:15:53 +01:00
parent 0f55d73b69
commit 9a6835bf06
2 changed files with 5 additions and 0 deletions

View File

@ -3174,6 +3174,10 @@ void RsGenExchange::processRecvdMessages()
for(auto& nxs_msg: msgs_to_store)
{
RsGxsMsgItem *item = dynamic_cast<RsGxsMsgItem*>(mSerialiser->deserialise(nxs_msg->msg.bin_data,&nxs_msg->msg.bin_len));
if(!item)
continue;
item->meta = *nxs_msg->metaData;
RsGxsMsgChange* c = new RsGxsMsgChange(RsGxsNotify::TYPE_RECEIVED_NEW, item->meta.mGroupId, item->meta.mMsgId,false);

View File

@ -85,6 +85,7 @@ class RsGxsMsgChange : public RsGxsNotify
public:
RsGxsMsgChange(NotifyType type, const RsGxsGroupId& gid, const RsGxsMessageId& msg_id,bool metaChange)
: RsGxsNotify(gid), mMsgId(msg_id), mNewMsgItem(nullptr),NOTIFY_TYPE(type), mMetaChange(metaChange) {}
virtual ~RsGxsMsgChange() override { delete mNewMsgItem ; }
RsGxsMessageId mMsgId;
RsGxsMsgItem *mNewMsgItem;