From 9e6200507b8616cbb1ee32c47918e159785c0a41 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 22 Jan 2014 19:06:51 -0500 Subject: [PATCH] Fix potential leak in OfferLinkToPlayer --- .../Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp index ff38afa6..7f54d112 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp @@ -740,19 +740,18 @@ void plNetLinkingMgr::OfferLinkToPlayer( const plAgeLinkStruct * inInfo, uint32_ // my special version - cjp void plNetLinkingMgr::OfferLinkToPlayer( const plAgeLinkStruct * inInfo, uint32_t playerID, plKey replyKey ) { - plNetClientMgr *mgr = plNetClientMgr::GetInstance(); - plLinkToAgeMsg * linkM = new plLinkToAgeMsg(inInfo); - linkM->AddReceiver(mgr->GetKey()); - - plKey host = mgr->GetLocalPlayerKey(); plNetTransport &transport = mgr->TransportMgr(); int guestIdx = transport.FindMember(playerID); plNetTransportMember *guestMem = transport.GetMember(guestIdx); // -1 ? - if(guestMem) + if (guestMem) { + plLinkToAgeMsg* linkM = new plLinkToAgeMsg(inInfo); + linkM->AddReceiver(mgr->GetKey()); + plKey guest = guestMem->GetAvatarKey(); + plKey host = mgr->GetLocalPlayerKey(); plAvatarMgr::OfferLinkingBook(host, guest, linkM, replyKey); } }