1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Fix plugin command memleak

This commit is contained in:
James Booth 2016-02-15 00:09:51 +00:00
parent bd928f0f29
commit 7945ef5277
4 changed files with 11 additions and 2 deletions

View File

@ -591,7 +591,7 @@ prefs_set_autoxa_time(gint value)
_save_prefs();
}
gchar **
gchar**
prefs_get_plugins(void)
{
if (!g_key_file_has_group(prefs, "plugins")) {
@ -604,6 +604,12 @@ prefs_get_plugins(void)
return g_key_file_get_string_list(prefs, "plugins", "load", NULL, NULL);
}
void
prefs_free_plugins(gchar **plugins)
{
g_strfreev(plugins);
}
void
prefs_set_occupants_size(gint value)
{

View File

@ -184,6 +184,7 @@ gint prefs_get_autoxa_time(void);
void prefs_set_autoxa_time(gint value);
gchar** prefs_get_plugins(void);
void prefs_free_plugins(gchar **plugins);
char prefs_get_otr_char(void);
void prefs_set_otr_char(char ch);

View File

@ -92,13 +92,14 @@ plugins_run_command(const char * const input)
gchar **args = parse_args(input, command->min_args, command->max_args, &result);
if (result == FALSE) {
ui_invalid_command_usage(command->usage, NULL);
g_strfreev(split);
return TRUE;
} else {
command->callback_func(command, args);
g_strfreev(split);
g_strfreev(args);
return TRUE;
}
g_strfreev(args);
}
p_command = g_slist_next(p_command);
}

View File

@ -92,6 +92,7 @@ plugins_init(void)
curr = g_slist_next(curr);
}
}
prefs_free_plugins(plugins_load);
return;
}