From 17890b1f61da9b0e8ea94ccfe32a9d0f6ebf3111 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Mon, 19 Aug 2013 07:15:56 -0400 Subject: Realloc apparently doesn't always behave like free() if size is zero. --- core/DHT.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'core/DHT.c') 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) CLIENT_ID_SIZE ); } + if (num_friends == 0) { + free(friends_list); + friends_list = NULL; + return 0; + } + temp = realloc(friends_list, sizeof(Friend) * (num_friends)); if (temp == NULL) -- cgit v1.2.3