Fixed memory leak in DistributedChatService::invitePeerToLobby when lobby not found.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8452 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-06-14 21:24:17 +00:00
parent e8b5ab9fae
commit c187c03758

View File

@ -1168,8 +1168,6 @@ void DistributedChatService::invitePeerToLobby(const ChatLobbyId& lobby_id, cons
std::cerr << "Sending invitation to peer " << peer_id << " to lobby "<< std::hex << lobby_id << std::dec << std::endl; std::cerr << "Sending invitation to peer " << peer_id << " to lobby "<< std::hex << lobby_id << std::dec << std::endl;
#endif #endif
RsChatLobbyInviteItem *item = new RsChatLobbyInviteItem ;
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
std::map<ChatLobbyId,ChatLobbyEntry>::iterator it = _chat_lobbys.find(lobby_id) ; std::map<ChatLobbyId,ChatLobbyEntry>::iterator it = _chat_lobbys.find(lobby_id) ;
@ -1181,6 +1179,9 @@ void DistributedChatService::invitePeerToLobby(const ChatLobbyId& lobby_id, cons
#endif #endif
return ; return ;
} }
RsChatLobbyInviteItem *item = new RsChatLobbyInviteItem ;
item->lobby_id = lobby_id ; item->lobby_id = lobby_id ;
item->lobby_name = it->second.lobby_name ; item->lobby_name = it->second.lobby_name ;
item->lobby_topic = it->second.lobby_topic ; item->lobby_topic = it->second.lobby_topic ;