Increment node refcount before adding to vector (#1304)
This commit is contained in:
parent
944420deb0
commit
a73185d939
@ -429,15 +429,15 @@ CNode* ConnectNode(CAddress addrConnect, const char *pszDest, bool fConnectToMas
|
|||||||
// Add node
|
// Add node
|
||||||
CNode* pnode = new CNode(hSocket, addrConnect, pszDest ? pszDest : "", false, true);
|
CNode* pnode = new CNode(hSocket, addrConnect, pszDest ? pszDest : "", false, true);
|
||||||
|
|
||||||
LOCK(cs_vNodes);
|
|
||||||
vNodes.push_back(pnode);
|
|
||||||
|
|
||||||
pnode->nTimeConnected = GetTime();
|
pnode->nTimeConnected = GetTime();
|
||||||
if(fConnectToMasternode) {
|
if(fConnectToMasternode) {
|
||||||
pnode->AddRef();
|
pnode->AddRef();
|
||||||
pnode->fMasternode = true;
|
pnode->fMasternode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOCK(cs_vNodes);
|
||||||
|
vNodes.push_back(pnode);
|
||||||
|
|
||||||
return pnode;
|
return pnode;
|
||||||
} else if (!proxyConnectionFailed) {
|
} else if (!proxyConnectionFailed) {
|
||||||
// If connecting to the node failed, and failure is not caused by a problem connecting to
|
// If connecting to the node failed, and failure is not caused by a problem connecting to
|
||||||
|
Loading…
Reference in New Issue
Block a user