Fix of memory leak
This commit is contained in:
parent
7f89e80d7b
commit
87cc96a011
2 changed files with 4 additions and 4 deletions
|
@ -139,7 +139,7 @@ int ipfs_repo_config_init(struct RepoConfig* config, unsigned int num_bits_for_k
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// swarm addresses
|
// swarm addresses
|
||||||
char* addr1 = malloc(27);
|
char* addr1 = malloc(64);
|
||||||
sprintf(addr1, "/ip4/0.0.0.0/tcp/%d", swarm_port);
|
sprintf(addr1, "/ip4/0.0.0.0/tcp/%d", swarm_port);
|
||||||
config->addresses->swarm_head = libp2p_utils_linked_list_new();
|
config->addresses->swarm_head = libp2p_utils_linked_list_new();
|
||||||
config->addresses->swarm_head->item = malloc(strlen(addr1) + 1);
|
config->addresses->swarm_head->item = malloc(strlen(addr1) + 1);
|
||||||
|
@ -155,7 +155,7 @@ int ipfs_repo_config_init(struct RepoConfig* config, unsigned int num_bits_for_k
|
||||||
config->addresses->api = malloc(strlen(addr1)+1);
|
config->addresses->api = malloc(strlen(addr1)+1);
|
||||||
strcpy(config->addresses->api, addr1);
|
strcpy(config->addresses->api, addr1);
|
||||||
sprintf(addr1, "/ip4/127.0.0.1/tcp/%d", 8080 + port_adder);
|
sprintf(addr1, "/ip4/127.0.0.1/tcp/%d", 8080 + port_adder);
|
||||||
config->addresses->gateway = malloc(strlen(addr1+1));
|
config->addresses->gateway = malloc(strlen(addr1)+1);
|
||||||
strcpy(config->addresses->gateway, addr1);
|
strcpy(config->addresses->gateway, addr1);
|
||||||
free(addr1);
|
free(addr1);
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,8 @@ int test_routing_put_value() {
|
||||||
|
|
||||||
// see if we have what we should...
|
// see if we have what we should...
|
||||||
libp2p_logger_debug("test_routing", "About to ask for the server to resolve the publisher.\n");
|
libp2p_logger_debug("test_routing", "About to ask for the server to resolve the publisher.\n");
|
||||||
char* args3[] = {"ipfs", "--config", ipfs_path_publisher, "resolve", peer_id_publisher};
|
char* args3[] = {"ipfs", "--config", ipfs_path_publisher, "name", "resolve", peer_id_publisher};
|
||||||
arguments = cli_arguments_new(5, args3);
|
arguments = cli_arguments_new(6, args3);
|
||||||
if (!ipfs_name(arguments))
|
if (!ipfs_name(arguments))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue