From f976e1c525aaf1ee02cb7c637dbb8f8db2043813 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 6 Nov 2018 20:38:35 +0100 Subject: [PATCH] removed memory leak in handlign of old chat lobby items --- libretroshare/src/chat/distributedchat.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libretroshare/src/chat/distributedchat.cc b/libretroshare/src/chat/distributedchat.cc index 5bc640fd7..2726e8ec0 100644 --- a/libretroshare/src/chat/distributedchat.cc +++ b/libretroshare/src/chat/distributedchat.cc @@ -1292,15 +1292,15 @@ void DistributedChatService::handleRecvLobbyInvite_Deprecated(RsChatLobbyInviteI #ifdef DEBUG_CHAT_LOBBIES std::cerr << "Received deprecated invite to lobby from " << item->PeerId() << " to lobby " << std::hex << item->lobby_id << std::dec << ", named " << item->lobby_name << item->lobby_topic << std::endl; #endif - RsChatLobbyInviteItem* newItem = new RsChatLobbyInviteItem(); + RsChatLobbyInviteItem newItem ; - newItem->lobby_id = item->lobby_id ; - newItem->lobby_name = item->lobby_name ; - newItem->lobby_topic = item->lobby_topic ; - newItem->lobby_flags = item->lobby_flags ; - newItem->PeerId( item->PeerId() ); + newItem.lobby_id = item->lobby_id ; + newItem.lobby_name = item->lobby_name ; + newItem.lobby_topic = item->lobby_topic ; + newItem.lobby_flags = item->lobby_flags ; + newItem.PeerId( item->PeerId() ); - handleRecvLobbyInvite(newItem); + handleRecvLobbyInvite(&newItem); // The item is not deleted inside this function. } void DistributedChatService::handleRecvLobbyInvite(RsChatLobbyInviteItem *item)