summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-config-file.c10
-rw-r--r--src/core/wee-hook.c4
-rw-r--r--src/gui/curses/gui-curses-main.c8
-rw-r--r--src/gui/gtk/gui-gtk-main.c28
-rw-r--r--src/gui/gui-bar.c1
-rw-r--r--src/gui/gui-buffer.c1
-rw-r--r--src/gui/gui-filter.c2
-rw-r--r--src/plugins/irc/irc-config.c7
8 files changed, 50 insertions, 11 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index a972cd5c6..67524806f 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -101,8 +101,14 @@ config_file_new (struct t_weechat_plugin *plugin, const char *name,
new_config_file->name = strdup (name);
length = strlen (name) + 8 + 1;
filename = malloc (length);
- snprintf (filename, length, "%s.conf", name);
- new_config_file->filename = strdup (filename);
+ if (filename)
+ {
+ snprintf (filename, length, "%s.conf", name);
+ new_config_file->filename = strdup (filename);
+ free (filename);
+ }
+ else
+ new_config_file->filename = strdup (name);
new_config_file->file = NULL;
new_config_file->callback_reload = callback_reload;
new_config_file->callback_reload_data = callback_reload_data;
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index d059c6d25..56861714f 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -1594,11 +1594,15 @@ unhook (struct t_hook *hook)
case HOOK_TYPE_INFO:
if (HOOK_INFO(hook, info_name))
free (HOOK_INFO(hook, info_name));
+ if (HOOK_INFO(hook, description))
+ free (HOOK_INFO(hook, description));
free ((struct t_hook_info *)hook->hook_data);
break;
case HOOK_TYPE_INFOLIST:
if (HOOK_INFOLIST(hook, infolist_name))
free (HOOK_INFOLIST(hook, infolist_name));
+ if (HOOK_INFOLIST(hook, description))
+ free (HOOK_INFOLIST(hook, description));
free ((struct t_hook_infolist *)hook->hook_data);
break;
case HOOK_NUM_TYPES:
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c
index b0b6f46f7..8c3a69da7 100644
--- a/src/gui/curses/gui-curses-main.c
+++ b/src/gui/curses/gui-curses-main.c
@@ -44,6 +44,7 @@
#include "../gui-buffer.h"
#include "../gui-chat.h"
#include "../gui-color.h"
+#include "../gui-filter.h"
#include "../gui-input.h"
#include "../gui-history.h"
#include "../gui-nicklist.h"
@@ -334,18 +335,25 @@ gui_main_end (int clean_exit)
gui_bar_item_end ();
gui_bar_free_all ();
+ /* remove filters */
+ gui_filter_free_all ();
+
/* free clipboard buffer */
if (gui_input_clipboard)
free (gui_input_clipboard);
/* delete all windows */
while (gui_windows)
+ {
gui_window_free (gui_windows);
+ }
gui_window_tree_free (&gui_windows_tree);
/* delete all buffers */
while (gui_buffers)
+ {
gui_buffer_close (gui_buffers, 0);
+ }
/* delete global history */
gui_history_global_free ();
diff --git a/src/gui/gtk/gui-gtk-main.c b/src/gui/gtk/gui-gtk-main.c
index 55ec7e2a3..8c1715b37 100644
--- a/src/gui/gtk/gui-gtk-main.c
+++ b/src/gui/gtk/gui-gtk-main.c
@@ -33,9 +33,12 @@
#include "../../core/wee-config.h"
#include "../../core/wee-utf8.h"
#include "../../plugins/plugin.h"
+#include "../gui-bar.h"
+#include "../gui-bar-item.h"
#include "../gui-chat.h"
#include "../gui-main.h"
#include "../gui-buffer.h"
+#include "../gui/gui-filter.h"
#include "../gui-history.h"
#include "../gui-input.h"
#include "../gui-window.h"
@@ -207,28 +210,32 @@ gui_main_loop ()
void
gui_main_end (int clean_exit)
{
- struct t_gui_window *ptr_win;
-
if (clean_exit)
{
+ /* remove bar items and bars */
+ gui_bar_item_end ();
+ gui_bar_free_all ();
+
+ /* remove filters */
+ gui_filter_free_all ();
+
/* free clipboard buffer */
if (gui_input_clipboard)
free(gui_input_clipboard);
-
+
/* delete all windows */
- for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
+ while (gui_windows)
{
+ gui_window_free (gui_windows);
/* TODO: destroy Gtk widgets */
}
+ gui_window_tree_free (&gui_windows_tree);
/* delete all buffers */
while (gui_buffers)
+ {
gui_buffer_close (gui_buffers, 0);
-
- /* delete all windows */
- while (gui_windows)
- gui_window_free (gui_windows);
- gui_window_tree_free (&gui_windows_tree);
+ }
/* delete global history */
gui_history_global_free ();
@@ -236,5 +243,8 @@ gui_main_end (int clean_exit)
/* reset title */
if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_title_reset ();
+
+ /* end color */
+ gui_color_end ();
}
}
diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c
index 6bb4e018f..e3b1f159d 100644
--- a/src/gui/gui-bar.c
+++ b/src/gui/gui-bar.c
@@ -1122,6 +1122,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
case GUI_BAR_NUM_OPTIONS:
break;
}
+ free (option_name);
}
return ptr_option;
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 3fa7b2e99..1f1cccfb4 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -943,6 +943,7 @@ gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another)
if (buffer->text_search_input)
free (buffer->text_search_input);
gui_nicklist_remove_all (buffer);
+ gui_nicklist_remove_group (buffer, buffer->nicklist_root);
if (buffer->highlight_words)
free (buffer->highlight_words);
if (buffer->highlight_tags_array)
diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c
index 96eb4239f..d27343a4f 100644
--- a/src/gui/gui-filter.c
+++ b/src/gui/gui-filter.c
@@ -364,6 +364,8 @@ gui_filter_free (struct t_gui_filter *filter)
free (filter->buffer);
if (filter->tags)
free (filter->tags);
+ if (filter->tags_array)
+ string_free_exploded (filter->tags_array);
if (filter->regex)
free (filter->regex);
if (filter->regex_prefix)
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 6355dbd4e..7dfe544cd 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -899,6 +899,13 @@ irc_config_server_create_default_options (struct t_config_section *section)
NULL,
NULL);
}
+
+ if (nicks)
+ free (nicks);
+ if (username)
+ free (username);
+ if (realname)
+ free (realname);
}
/*