Fix small memory leak.

This commit is contained in:
John Jones 2017-08-09 12:26:26 -05:00
parent dd69216c75
commit 0e24b0a1d3
2 changed files with 2 additions and 0 deletions

View file

@ -25,6 +25,7 @@ int ipfs_node_online_protocol_handlers_free(struct Libp2pVector* handlers) {
for(int i = 0; i < handlers->total; i++) { for(int i = 0; i < handlers->total; i++) {
struct Libp2pProtocolHandler* current = (struct Libp2pProtocolHandler*) libp2p_utils_vector_get(handlers, i); struct Libp2pProtocolHandler* current = (struct Libp2pProtocolHandler*) libp2p_utils_vector_get(handlers, i);
current->Shutdown(current->context); current->Shutdown(current->context);
free(current);
} }
libp2p_utils_vector_free(handlers); libp2p_utils_vector_free(handlers);
return 1; return 1;

View file

@ -287,6 +287,7 @@ int test_bitswap_retrieve_file_known_remote() {
libp2p_logger_add_class("null"); libp2p_logger_add_class("null");
libp2p_logger_add_class("online"); libp2p_logger_add_class("online");
libp2p_logger_add_class("multistream"); libp2p_logger_add_class("multistream");
libp2p_logger_add_class("secio");
char* ipfs_path = "/tmp/test1"; char* ipfs_path = "/tmp/test1";
char* peer_id_1 = NULL, *peer_id_2 = NULL; char* peer_id_1 = NULL, *peer_id_2 = NULL;