summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-06-21 12:45:50 +0200
committerSebastien Helleu <flashcode@flashtux.org>2009-06-21 12:45:50 +0200
commit679e477abb7ce6f0588027bcf3e67aca8cfe3f11 (patch)
tree7fdcd9f82a4639b9f452093544bb9c2644bd7d68 /src
parentb698a9ce4a2fa10166fb901c6d68cbea5dc15341 (diff)
downloadweechat-679e477abb7ce6f0588027bcf3e67aca8cfe3f11.zip
Fix some memory leaks in command hook (completion templates), buffer closing, partial completion
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-hook.c15
-rw-r--r--src/gui/gui-buffer.c4
-rw-r--r--src/gui/gui-completion.c9
3 files changed, 20 insertions, 8 deletions
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index a18883c06..e36b46f40 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -483,6 +483,7 @@ hook_command_build_completion (struct t_hook_command *hook_command)
}
}
}
+ weelist_free (list);
}
}
@@ -2176,8 +2177,22 @@ unhook (struct t_hook *hook)
}
free (HOOK_COMMAND(hook, cplt_templates));
}
+ if (HOOK_COMMAND(hook, cplt_templates_static))
+ free (HOOK_COMMAND(hook, cplt_templates_static));
if (HOOK_COMMAND(hook, cplt_template_num_args))
free (HOOK_COMMAND(hook, cplt_template_num_args));
+ if (HOOK_COMMAND(hook, cplt_template_args))
+ free (HOOK_COMMAND(hook, cplt_template_args));
+ if (HOOK_COMMAND(hook, cplt_template_args_concat))
+ {
+ for (i = 0;
+ i < HOOK_COMMAND(hook, cplt_template_num_args_concat);
+ i++)
+ {
+ free (HOOK_COMMAND(hook, cplt_template_args_concat[i]));
+ }
+ free (HOOK_COMMAND(hook, cplt_template_args_concat));
+ }
break;
case HOOK_TYPE_COMMAND_RUN:
if (HOOK_COMMAND_RUN(hook, command))
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index e304dd82d..5abff70d1 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -1515,6 +1515,10 @@ gui_buffer_close (struct t_gui_buffer *buffer)
/* free all lines */
gui_line_free_all (buffer);
+ if (buffer->own_lines)
+ free (buffer->own_lines);
+ if (buffer->mixed_lines)
+ free (buffer->mixed_lines);
/* free some data */
if (buffer->title)
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index a6a399bb8..8d11da52e 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -1704,7 +1704,7 @@ gui_completion_partial_build_list (struct t_gui_completion *completion,
{
int char_size, items_count;
char utf_char[16], *word;
- struct t_weelist *weelist_temp, *weelist_words;
+ struct t_weelist *weelist_temp;
struct t_weelist_item *ptr_item, *next_item;
gui_completion_partial_list_free_all (completion);
@@ -1716,13 +1716,6 @@ gui_completion_partial_build_list (struct t_gui_completion *completion,
if (!weelist_temp)
return;
- weelist_words = weelist_new ();
- if (!weelist_words)
- {
- weelist_free (weelist_temp);
- return;
- }
-
for (ptr_item = completion->completion_list->items; ptr_item;
ptr_item = ptr_item->next_item)
{