Browse Source

Fix potential leak in OfferLinkToPlayer

Adam Johnson 11 years ago
parent
commit
9e6200507b
  1. 9
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp

9
Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp

@ -740,19 +740,18 @@ void plNetLinkingMgr::OfferLinkToPlayer( const plAgeLinkStruct * inInfo, uint32_
// my special version - cjp // my special version - cjp
void plNetLinkingMgr::OfferLinkToPlayer( const plAgeLinkStruct * inInfo, uint32_t playerID, plKey replyKey ) void plNetLinkingMgr::OfferLinkToPlayer( const plAgeLinkStruct * inInfo, uint32_t playerID, plKey replyKey )
{ {
plNetClientMgr *mgr = plNetClientMgr::GetInstance(); plNetClientMgr *mgr = plNetClientMgr::GetInstance();
plLinkToAgeMsg * linkM = new plLinkToAgeMsg(inInfo);
linkM->AddReceiver(mgr->GetKey());
plKey host = mgr->GetLocalPlayerKey();
plNetTransport &transport = mgr->TransportMgr(); plNetTransport &transport = mgr->TransportMgr();
int guestIdx = transport.FindMember(playerID); int guestIdx = transport.FindMember(playerID);
plNetTransportMember *guestMem = transport.GetMember(guestIdx); // -1 ? plNetTransportMember *guestMem = transport.GetMember(guestIdx); // -1 ?
if (guestMem) if (guestMem)
{ {
plLinkToAgeMsg* linkM = new plLinkToAgeMsg(inInfo);
linkM->AddReceiver(mgr->GetKey());
plKey guest = guestMem->GetAvatarKey(); plKey guest = guestMem->GetAvatarKey();
plKey host = mgr->GetLocalPlayerKey();
plAvatarMgr::OfferLinkingBook(host, guest, linkM, replyKey); plAvatarMgr::OfferLinkingBook(host, guest, linkM, replyKey);
} }
} }

Loading…
Cancel
Save