summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-03-26 14:06:52 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2010-03-26 14:06:52 +0100
commit6dd916eaedfd23a93ba7aa2e2b39511e7e907dec (patch)
tree9508d6f382c4da3e6bc46bcc0ac011cc0eb1e0a4
parenta1b9ea5d43a335beca7bfdd0f6f12a21f1c7087a (diff)
Fixed memory leaks in hash tables and nick list.
-rw-r--r--channel.c2
-rw-r--r--nick.c2
-rw-r--r--user.c2
-rw-r--r--word.c2
4 files changed, 7 insertions, 1 deletions
diff --git a/channel.c b/channel.c
index 86e993d..8c32a96 100644
--- a/channel.c
+++ b/channel.c
@@ -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;
}
diff --git a/nick.c b/nick.c
index 181a3a1..088edca 100644
--- a/nick.c
+++ b/nick.c
@@ -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);
}
diff --git a/user.c b/user.c
index de10e1c..b64ca7c 100644
--- a/user.c
+++ b/user.c
@@ -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;
diff --git a/word.c b/word.c
index bf1fada..1e8d56a 100644
--- a/word.c
+++ b/word.c
@@ -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;