summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/DHT.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/DHT.c b/core/DHT.c
index 399d491b..8c3ef5a8 100644
--- a/core/DHT.c
+++ b/core/DHT.c
@@ -776,8 +776,11 @@ int DHT_delfriend(uint8_t * client_id)
776 { 776 {
777 if(memcmp(friends_list[i].client_id, client_id, CLIENT_ID_SIZE) == 0)//Equal 777 if(memcmp(friends_list[i].client_id, client_id, CLIENT_ID_SIZE) == 0)//Equal
778 { 778 {
779 memcpy(friends_list[num_friends].client_id, friends_list[i].client_id, CLIENT_ID_SIZE);
780 num_friends--; 779 num_friends--;
780 if(num_friends != i)
781 {
782 memcpy(friends_list[i].client_id, friends_list[num_friends].client_id, CLIENT_ID_SIZE);
783 }
781 temp = realloc(friends_list, sizeof(friends_list) * (num_friends)); 784 temp = realloc(friends_list, sizeof(friends_list) * (num_friends));
782 if(temp != NULL) 785 if(temp != NULL)
783 { 786 {