Fixed small memory leak

This commit is contained in:
John Jones 2017-05-11 07:13:13 -05:00
parent def5331d4c
commit d6ee0f7d5d
2 changed files with 6 additions and 1 deletions

View file

@ -128,8 +128,10 @@ int ipfs_routing_online_find_providers(struct IpfsRouting* routing, const unsign
libp2p_logger_debug("online", "FindProviders: Found provider locally. Searching for peer.\n");
// now translate the peer id into a peer to get the multiaddresses
peer = libp2p_peerstore_get_peer(routing->local_node->peerstore, peer_id, peer_id_size);
if (peer == NULL)
free(peer_id);
if (peer == NULL) {
return 0;
}
*peers = libp2p_utils_vector_new(1);
libp2p_utils_vector_add(*peers, libp2p_peer_copy(peer));

View file

@ -120,6 +120,9 @@ int test_import_large_file() {
}
}
fclose(f1);
fclose(f2);
retVal = 1;
exit: