diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-17 13:54:19 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-17 13:54:19 -0400 |
commit | f27b5c9296c51d6d7c52fa1a483ac92fb097562f (patch) | |
tree | 6dd27e853da9c6cabc668e346429ad5957df306e | |
parent | 4864cb9edbe567af6f774bcf6ad90211449a258f (diff) |
Fixed bug with deleting friends.
-rw-r--r-- | core/DHT.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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 | { |