diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-03-26 14:06:52 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-03-26 14:06:52 +0100 |
commit | 6dd916eaedfd23a93ba7aa2e2b39511e7e907dec (patch) | |
tree | 9508d6f382c4da3e6bc46bcc0ac011cc0eb1e0a4 | |
parent | a1b9ea5d43a335beca7bfdd0f6f12a21f1c7087a (diff) |
Fixed memory leaks in hash tables and nick list.
-rw-r--r-- | channel.c | 2 | ||||
-rw-r--r-- | nick.c | 2 | ||||
-rw-r--r-- | user.c | 2 | ||||
-rw-r--r-- | word.c | 2 |
4 files changed, 7 insertions, 1 deletions
@@ -55,9 +55,11 @@ struct channel_t *channel_get(int index) { void channel_free() { for(int i = 0; i < channel_count; i++) { free(channels[i].name); + free(channels[i].xmlpath); struct channel_file_t *file = channels[i].files; while(file) { struct channel_file_t *next = file->next; + free(file->path); free(file); file = next; } @@ -103,6 +103,6 @@ void nick_free() { free(nick); nick = next; } - free(nicks); + nicks = NULL; // nicks already free'd by first iteration pcre_free((void*)nick_pcre_tables); } @@ -44,6 +44,8 @@ struct user_t *user_get(char *nick) { void user_free() { struct user_t *user; for(int i = 0; i < USERS_MAX; i++) { + if(users[i].nick) + free(users[i].nick); user = users[i].next; while(user) { struct user_t *temp = user->next; @@ -37,6 +37,8 @@ struct word_t *word_get(char *name) { void word_free() { struct word_t *word; for(int i = 0; i < WORDS_MAX; i++) { + if(words[i].name) + free(words[i].name); word = words[i].next; while(word) { struct word_t *temp = word->next; |