summaryrefslogtreecommitdiff
path: root/core/DHT.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-08-19 07:15:56 -0400
committerirungentoo <irungentoo@gmail.com>2013-08-19 07:15:56 -0400
commit17890b1f61da9b0e8ea94ccfe32a9d0f6ebf3111 (patch)
tree4820965c7889de2c6728aa4b69806426afcf1a70 /core/DHT.c
parent88986f793a02921e8a23e540a80275e91c87a82a (diff)
Realloc apparently doesn't always behave like free() if size is zero.
Diffstat (limited to 'core/DHT.c')
-rw-r--r--core/DHT.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/DHT.c b/core/DHT.c
index 55f34994..924e3216 100644
--- a/core/DHT.c
+++ b/core/DHT.c
@@ -704,6 +704,12 @@ int DHT_delfriend(uint8_t *client_id)
704 CLIENT_ID_SIZE ); 704 CLIENT_ID_SIZE );
705 } 705 }
706 706
707 if (num_friends == 0) {
708 free(friends_list);
709 friends_list = NULL;
710 return 0;
711 }
712
707 temp = realloc(friends_list, sizeof(Friend) * (num_friends)); 713 temp = realloc(friends_list, sizeof(Friend) * (num_friends));
708 714
709 if (temp == NULL) 715 if (temp == NULL)