summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-07-17 13:54:19 -0400
committerirungentoo <irungentoo@gmail.com>2013-07-17 13:54:19 -0400
commitf27b5c9296c51d6d7c52fa1a483ac92fb097562f (patch)
tree6dd27e853da9c6cabc668e346429ad5957df306e
parent4864cb9edbe567af6f774bcf6ad90211449a258f (diff)
Fixed bug with deleting friends.
-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 {