diff options
Diffstat (limited to 'toxcore/net_crypto.c')
-rw-r--r-- | toxcore/net_crypto.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index aec2a9e7..a6c3ecd9 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -473,8 +473,9 @@ static int getcryptconnection_id(Net_Crypto *c, uint8_t *public_key) | |||
473 | /* Set the size of the friend list to numfriends. | 473 | /* Set the size of the friend list to numfriends. |
474 | * | 474 | * |
475 | * return -1 if realloc fails. | 475 | * return -1 if realloc fails. |
476 | * return 0 if it succeeds. | ||
476 | */ | 477 | */ |
477 | int realloc_cryptoconnection(Net_Crypto *c, uint32_t num) | 478 | static int realloc_cryptoconnection(Net_Crypto *c, uint32_t num) |
478 | { | 479 | { |
479 | if (num == 0) { | 480 | if (num == 0) { |
480 | free(c->crypto_connections); | 481 | free(c->crypto_connections); |
@@ -604,8 +605,11 @@ int crypto_kill(Net_Crypto *c, int crypt_connection_id) | |||
604 | break; | 605 | break; |
605 | } | 606 | } |
606 | 607 | ||
607 | c->crypto_connections_length = i; | 608 | if (c->crypto_connections_length != i) { |
608 | realloc_cryptoconnection(c, c->crypto_connections_length); | 609 | c->crypto_connections_length = i; |
610 | realloc_cryptoconnection(c, c->crypto_connections_length); | ||
611 | } | ||
612 | |||
609 | return 0; | 613 | return 0; |
610 | } | 614 | } |
611 | 615 | ||