diff options
Diffstat (limited to 'core/Messenger.c')
-rw-r--r-- | core/Messenger.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/Messenger.c b/core/Messenger.c index 2b5c8241..8a5d9ed4 100644 --- a/core/Messenger.c +++ b/core/Messenger.c | |||
@@ -37,6 +37,8 @@ static int write_cryptpacket_id(Messenger *m, int friendnumber, uint8_t packet_i | |||
37 | return -1 if realloc fails */ | 37 | return -1 if realloc fails */ |
38 | int realloc_friendlist(Messenger *m, uint32_t num) | 38 | int realloc_friendlist(Messenger *m, uint32_t num) |
39 | { | 39 | { |
40 | if (num * sizeof(Friend) == 0) return -1; | ||
41 | |||
40 | Friend *newfriendlist = realloc(m->friendlist, num * sizeof(Friend)); | 42 | Friend *newfriendlist = realloc(m->friendlist, num * sizeof(Friend)); |
41 | 43 | ||
42 | if (newfriendlist == NULL && num != 0) | 44 | if (newfriendlist == NULL && num != 0) |
@@ -597,7 +599,6 @@ int write_cryptpacket_id(Messenger *m, int friendnumber, uint8_t packet_id, uint | |||
597 | 599 | ||
598 | /*Interval in seconds between LAN discovery packet sending*/ | 600 | /*Interval in seconds between LAN discovery packet sending*/ |
599 | #define LAN_DISCOVERY_INTERVAL 60 | 601 | #define LAN_DISCOVERY_INTERVAL 60 |
600 | |||
601 | #define PORT 33445 | 602 | #define PORT 33445 |
602 | 603 | ||
603 | /*Send a LAN discovery packet every LAN_DISCOVERY_INTERVAL seconds*/ | 604 | /*Send a LAN discovery packet every LAN_DISCOVERY_INTERVAL seconds*/ |
@@ -951,6 +952,7 @@ int Messenger_load(Messenger *m, uint8_t *data, uint32_t length) | |||
951 | } | 952 | } |
952 | } | 953 | } |
953 | 954 | ||
955 | free(temp); | ||
954 | data += size; | 956 | data += size; |
955 | length -= size; | 957 | length -= size; |
956 | 958 | ||
@@ -968,7 +970,5 @@ int Messenger_load(Messenger *m, uint8_t *data, uint32_t length) | |||
968 | 970 | ||
969 | setname(m, data, small_size); | 971 | setname(m, data, small_size); |
970 | 972 | ||
971 | free(temp); | ||
972 | return 0; | 973 | return 0; |
973 | } | 974 | } |
974 | |||