Memory leak fixed
This commit is contained in:
parent
ebb94d96cb
commit
5a9ab47635
1 changed files with 4 additions and 0 deletions
|
@ -108,6 +108,10 @@ int libp2p_peer_connect(struct RsaPrivateKey* privateKey, struct Libp2pPeer* pee
|
||||||
if (!multiaddress_get_ip_address(ma, &ip))
|
if (!multiaddress_get_ip_address(ma, &ip))
|
||||||
continue;
|
continue;
|
||||||
int port = multiaddress_get_ip_port(ma);
|
int port = multiaddress_get_ip_port(ma);
|
||||||
|
// out with the old
|
||||||
|
if (peer->sessionContext != NULL) {
|
||||||
|
libp2p_session_context_free(peer->sessionContext);
|
||||||
|
}
|
||||||
peer->sessionContext = libp2p_session_context_new();
|
peer->sessionContext = libp2p_session_context_new();
|
||||||
peer->sessionContext->datastore = datastore;
|
peer->sessionContext->datastore = datastore;
|
||||||
peer->sessionContext->insecure_stream = libp2p_net_multistream_connect_with_timeout(ip, port, timeout);
|
peer->sessionContext->insecure_stream = libp2p_net_multistream_connect_with_timeout(ip, port, timeout);
|
||||||
|
|
Loading…
Reference in a new issue