mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixed segfault.
This commit is contained in:
parent
691dac3cb0
commit
ce60b9cf52
|
@ -296,6 +296,10 @@ loop_top:
|
|||
c_sleep(500);
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_DHT_FRIENDS; ++i) {
|
||||
ck_assert_msg(DHT_delfriend(dhts[pairs[i].tox2], dhts[pairs[i].tox1]->self_public_key, 1) == 0, "Failed to delete friend");
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_DHT; ++i) {
|
||||
void *n = dhts[i]->net;
|
||||
kill_DHT(dhts[i]);
|
||||
|
|
|
@ -813,11 +813,20 @@ static int dealloc_buckets(DHT_Bucket *bucket)
|
|||
|
||||
/* pk doesn't matter, want any nodes from both lower buckets. */
|
||||
uint8_t pk[crypto_box_PUBLICKEYBYTES] = {0};
|
||||
int ret = recursive_DHT_bucket_get_nodes(bucket, bucket->client_list, DHT_BUCKET_NODES, pk, 1, 1);
|
||||
|
||||
Client_data nodes[DHT_BUCKET_NODES];
|
||||
int ret = recursive_DHT_bucket_get_nodes(bucket, nodes, DHT_BUCKET_NODES, pk, 1, 1);
|
||||
|
||||
recursive_free_buckets(bucket);
|
||||
bucket->empty = 0;
|
||||
|
||||
if (ret >= 1) {
|
||||
bucket->client_list = calloc(DHT_BUCKET_NODES, sizeof(Client_data));
|
||||
|
||||
if (bucket->client_list)
|
||||
memcpy(bucket->client_list, nodes, sizeof(nodes));
|
||||
}
|
||||
|
||||
if (ret >= 0) {
|
||||
return 0;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user