mirror of
https://github.com/weechat/weechat.git
synced 2026-07-03 16:23:14 +02:00
Fix some memory leaks in command hook (completion templates), buffer closing, partial completion
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user