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
|
||||
CNode* pnode = new CNode(hSocket, addrConnect, pszDest ? pszDest : "", false, true);
|
||||
|
||||
LOCK(cs_vNodes);
|
||||
vNodes.push_back(pnode);
|
||||
|
||||
pnode->nTimeConnected = GetTime();
|
||||
if(fConnectToMasternode) {
|
||||
pnode->AddRef();
|
||||
pnode->fMasternode = true;
|
||||
}
|
||||
|
||||
LOCK(cs_vNodes);
|
||||
vNodes.push_back(pnode);
|
||||
|
||||
return pnode;
|
||||
} else if (!proxyConnectionFailed) {
|
||||
// If connecting to the node failed, and failure is not caused by a problem connecting to
|
||||
|
Loading…
Reference in New Issue
Block a user