summaryrefslogtreecommitdiff
path: root/core/Messenger.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/Messenger.c')
-rw-r--r--core/Messenger.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/core/Messenger.c b/core/Messenger.c
index 690a81b1..bed59d4d 100644
--- a/core/Messenger.c
+++ b/core/Messenger.c
@@ -120,6 +120,7 @@ void getaddress(Messenger *m, uint8_t *address)
120 * return FAERR_BADCHECKSUM if bad checksum in address 120 * return FAERR_BADCHECKSUM if bad checksum in address
121 * return FAERR_SETNEWNOSPAM if the friend was already there but the nospam was different 121 * return FAERR_SETNEWNOSPAM if the friend was already there but the nospam was different
122 * (the nospam for that friend was set to the new one) 122 * (the nospam for that friend was set to the new one)
123 * return FAERR_NOMEM if increasing the friend list size fails
123 */ 124 */
124int m_addfriend(Messenger *m, uint8_t *address, uint8_t *data, uint16_t length) 125int m_addfriend(Messenger *m, uint8_t *address, uint8_t *data, uint16_t length)
125{ 126{
@@ -148,7 +149,8 @@ int m_addfriend(Messenger *m, uint8_t *address, uint8_t *data, uint16_t length)
148 } 149 }
149 150
150 /* resize the friend list if necessary */ 151 /* resize the friend list if necessary */
151 realloc_friendlist(m, m->numfriends + 1); 152 if (realloc_friendlist(m, m->numfriends + 1) != 0)
153 return FAERR_NOMEM;
152 154
153 uint32_t i; 155 uint32_t i;
154 for (i = 0; i <= m->numfriends; ++i) { 156 for (i = 0; i <= m->numfriends; ++i) {
@@ -180,7 +182,8 @@ int m_addfriend_norequest(Messenger *m, uint8_t * client_id)
180 return -1; 182 return -1;
181 183
182 /* resize the friend list if necessary */ 184 /* resize the friend list if necessary */
183 realloc_friendlist(m, m->numfriends + 1); 185 if (realloc_friendlist(m, m->numfriends + 1) != 0)
186 return FAERR_NOMEM;
184 187
185 uint32_t i; 188 uint32_t i;
186 for (i = 0; i <= m->numfriends; ++i) { 189 for (i = 0; i <= m->numfriends; ++i) {
@@ -221,7 +224,9 @@ int m_delfriend(Messenger *m, int friendnumber)
221 break; 224 break;
222 } 225 }
223 m->numfriends = i; 226 m->numfriends = i;
224 realloc_friendlist(m, m->numfriends + 1); 227
228 if (realloc_friendlist(m, m->numfriends + 1) != 0)
229 return FAERR_NOMEM;
225 230
226 return 0; 231 return 0;
227} 232}