Browse Source

Fix leak in GetLinkToMyNeighborhood

pyAgeLinkStruct copies the plAgeLinkStruct, so we can create our initial
ALS on the stack and avoid crazy memory logic.
Adam Johnson 11 years ago
parent
commit
571bdbab01
  1. 8
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp

8
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp

@ -183,14 +183,12 @@ PyObject *pyVaultPlayerNode::GetPlayerInfo()
PyObject *pyVaultPlayerNode::GetLinkToMyNeighborhood() PyObject *pyVaultPlayerNode::GetLinkToMyNeighborhood()
{ {
plAgeLinkStruct * link = new plAgeLinkStruct(); plAgeLinkStruct link;
if (VaultGetLinkToMyNeighborhood(&link)) {
if (VaultGetLinkToMyNeighborhood(link)) { PyObject * result = pyAgeLinkStruct::New(&link);
PyObject * result = pyAgeLinkStruct::New(link);
return result; return result;
} }
delete link;
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
} }

Loading…
Cancel
Save