correctly handle empty list of replication servers
This commit is contained in:
parent
d969f48324
commit
9bceade4d8
1 changed files with 14 additions and 16 deletions
|
@ -481,10 +481,7 @@ int fs_repo_open_config(struct FSRepo* repo) {
|
||||||
// nodes list
|
// nodes list
|
||||||
int nodes_pos = _find_token(data, tokens, num_tokens, curr_pos, "Nodes");
|
int nodes_pos = _find_token(data, tokens, num_tokens, curr_pos, "Nodes");
|
||||||
if (nodes_pos >= 0) {
|
if (nodes_pos >= 0) {
|
||||||
if (tokens[nodes_pos].type != JSMN_ARRAY) {
|
if (tokens[nodes_pos].type == JSMN_ARRAY) {
|
||||||
free(data);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int nodes_size = tokens[nodes_pos].size;
|
int nodes_size = tokens[nodes_pos].size;
|
||||||
repo->config->replication->nodes = libp2p_utils_vector_new(nodes_size);
|
repo->config->replication->nodes = libp2p_utils_vector_new(nodes_size);
|
||||||
nodes_pos++;
|
nodes_pos++;
|
||||||
|
@ -500,6 +497,7 @@ int fs_repo_open_config(struct FSRepo* repo) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// free the memory used reading the json file
|
// free the memory used reading the json file
|
||||||
free(data);
|
free(data);
|
||||||
free(priv_key_base64);
|
free(priv_key_base64);
|
||||||
|
|
Loading…
Reference in a new issue