diff options
Diffstat (limited to 'core/DHT.c')
-rw-r--r-- | core/DHT.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -126,6 +126,7 @@ int client_in_list(Client_data * list, uint32_t length, uint8_t * client_id, IP_ | |||
126 | { | 126 | { |
127 | memcpy(list[i].client_id, client_id, CLIENT_ID_SIZE); | 127 | memcpy(list[i].client_id, client_id, CLIENT_ID_SIZE); |
128 | } | 128 | } |
129 | |||
129 | for(j = 0; j < CLIENT_ID_SIZE; j++) | 130 | for(j = 0; j < CLIENT_ID_SIZE; j++) |
130 | { | 131 | { |
131 | 132 | ||
@@ -768,7 +769,7 @@ int DHT_addfriend(uint8_t * client_id) | |||
768 | { | 769 | { |
769 | temp = malloc(sizeof(Friend)); | 770 | temp = malloc(sizeof(Friend)); |
770 | } | 771 | } |
771 | if(num_friends > 0) | 772 | else |
772 | { | 773 | { |
773 | temp = realloc(friends_list, sizeof(Friend) * (num_friends + 1)); | 774 | temp = realloc(friends_list, sizeof(Friend) * (num_friends + 1)); |
774 | } | 775 | } |
@@ -782,8 +783,6 @@ int DHT_addfriend(uint8_t * client_id) | |||
782 | memcpy(friends_list[num_friends].client_id, client_id, CLIENT_ID_SIZE); | 783 | memcpy(friends_list[num_friends].client_id, client_id, CLIENT_ID_SIZE); |
783 | num_friends++; | 784 | num_friends++; |
784 | return 0; | 785 | return 0; |
785 | |||
786 | |||
787 | } | 786 | } |
788 | 787 | ||
789 | 788 | ||