core: fix potential memory leak with infolists not freed in plugins (debian #751108)
The memory leak should not happen if infolists are properly freed by plugins, and it happened only on unload of plugins (or exit).
This commit is contained in:
parent
955ed344c2
commit
d0fa44865c
@ -15,6 +15,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
||||
|
||||
== Version 1.0 (under dev)
|
||||
|
||||
* core: fix potential memory leak with infolists not freed in plugins
|
||||
(debian #751108)
|
||||
* core: fix color display of last color number + 1 (closes #101)
|
||||
* core: add bar item "buffer_short_name" (task #10882)
|
||||
* core: add option "send" in command /input (send text to a buffer)
|
||||
|
@ -68,7 +68,7 @@ extern struct t_infolist *last_weechat_infolist;
|
||||
|
||||
/* list functions */
|
||||
|
||||
extern struct t_infolist *infolist_new ();
|
||||
extern struct t_infolist *infolist_new (struct t_weechat_plugin *plugin);
|
||||
extern int infolist_valid (struct t_infolist *infolist);
|
||||
extern struct t_infolist_item *infolist_new_item (struct t_infolist *infolist);
|
||||
extern struct t_infolist_var *infolist_new_var_integer (struct t_infolist_item *item,
|
||||
|
@ -618,7 +618,7 @@ upgrade_file_read_object (struct t_upgrade_file *upgrade_file)
|
||||
goto end;
|
||||
}
|
||||
|
||||
infolist = infolist_new ();
|
||||
infolist = infolist_new (NULL);
|
||||
if (!infolist)
|
||||
{
|
||||
UPGRADE_ERROR(_("read - infolist creation"), "");
|
||||
|
@ -75,7 +75,7 @@ upgrade_weechat_save_history (struct t_upgrade_file *upgrade_file,
|
||||
if (!last_history)
|
||||
return 1;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (!ptr_infolist)
|
||||
return 0;
|
||||
|
||||
@ -128,7 +128,7 @@ upgrade_weechat_save_buffers (struct t_upgrade_file *upgrade_file)
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
/* save buffer */
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (!ptr_infolist)
|
||||
return 0;
|
||||
if (!gui_buffer_add_to_infolist (ptr_infolist, ptr_buffer))
|
||||
@ -146,7 +146,7 @@ upgrade_weechat_save_buffers (struct t_upgrade_file *upgrade_file)
|
||||
/* save nicklist */
|
||||
if (ptr_buffer->nicklist)
|
||||
{
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (!ptr_infolist)
|
||||
return 0;
|
||||
if (!gui_nicklist_add_to_infolist (ptr_infolist, ptr_buffer, NULL))
|
||||
@ -166,7 +166,7 @@ upgrade_weechat_save_buffers (struct t_upgrade_file *upgrade_file)
|
||||
for (ptr_line = ptr_buffer->own_lines->first_line; ptr_line;
|
||||
ptr_line = ptr_line->next_line)
|
||||
{
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (!ptr_infolist)
|
||||
return 0;
|
||||
if (!gui_line_add_to_infolist (ptr_infolist,
|
||||
@ -212,7 +212,7 @@ upgrade_weechat_save_misc (struct t_upgrade_file *upgrade_file)
|
||||
struct t_infolist_item *ptr_item;
|
||||
int rc;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (!ptr_infolist)
|
||||
return 0;
|
||||
|
||||
@ -264,7 +264,7 @@ upgrade_weechat_save_hotlist (struct t_upgrade_file *upgrade_file)
|
||||
for (ptr_hotlist = gui_hotlist; ptr_hotlist;
|
||||
ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (!ptr_infolist)
|
||||
return 0;
|
||||
if (!gui_hotlist_add_to_infolist (ptr_infolist, ptr_hotlist))
|
||||
@ -298,7 +298,7 @@ upgrade_weechat_save_layout_window_tree (struct t_upgrade_file *upgrade_file,
|
||||
struct t_infolist *ptr_infolist;
|
||||
int rc;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (!ptr_infolist)
|
||||
return 0;
|
||||
|
||||
|
@ -498,7 +498,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
if (pointer && (!gui_bar_valid (pointer)))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (pointer)
|
||||
@ -536,7 +536,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
if (pointer && (!gui_bar_item_valid (pointer)))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (pointer)
|
||||
@ -575,7 +575,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
if (pointer && (!gui_bar_window_valid (pointer)))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (pointer)
|
||||
@ -626,7 +626,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
if (pointer && (!gui_buffer_valid (pointer)))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (pointer)
|
||||
@ -670,7 +670,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
for (ptr_line = ((struct t_gui_buffer *)pointer)->own_lines->first_line;
|
||||
@ -689,7 +689,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
}
|
||||
else if (string_strcasecmp (infolist_name, "filter") == 0)
|
||||
{
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
for (ptr_filter = gui_filters; ptr_filter;
|
||||
@ -714,7 +714,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
if (pointer && (!gui_buffer_valid (pointer)))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
for (ptr_history = (pointer) ?
|
||||
@ -736,7 +736,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
if (pointer && !hook_valid (pointer))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (!hook_add_to_infolist (ptr_infolist, pointer, arguments))
|
||||
@ -749,7 +749,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
}
|
||||
else if (string_strcasecmp (infolist_name, "hotlist") == 0)
|
||||
{
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
for (ptr_hotlist = gui_hotlist; ptr_hotlist;
|
||||
@ -766,7 +766,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
}
|
||||
else if (string_strcasecmp (infolist_name, "key") == 0)
|
||||
{
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (arguments && arguments[0])
|
||||
@ -790,7 +790,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
}
|
||||
else if (string_strcasecmp (infolist_name, "layout") == 0)
|
||||
{
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
for (ptr_layout = gui_layouts; ptr_layout;
|
||||
@ -811,7 +811,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
if (!pointer || (!gui_buffer_valid (pointer)))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (!gui_nicklist_add_to_infolist (ptr_infolist, pointer, arguments))
|
||||
@ -824,7 +824,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
}
|
||||
else if (string_strcasecmp (infolist_name, "option") == 0)
|
||||
{
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (!config_file_add_to_infolist (ptr_infolist, arguments))
|
||||
@ -841,7 +841,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
if (pointer && (!plugin_valid (pointer)))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (pointer)
|
||||
@ -880,7 +880,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
if (pointer && (!proxy_valid (pointer)))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (pointer)
|
||||
@ -915,7 +915,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
}
|
||||
else if (string_strcasecmp (infolist_name, "url_options") == 0)
|
||||
{
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
for (i = 0; url_options[i].name; i++)
|
||||
@ -935,7 +935,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
if (pointer && (!gui_window_valid (pointer)))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = infolist_new ();
|
||||
ptr_infolist = infolist_new (NULL);
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (pointer)
|
||||
|
@ -57,7 +57,7 @@ struct timeval;
|
||||
* please change the date with current one; for a second change at same
|
||||
* date, increment the 01, otherwise please keep 01.
|
||||
*/
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20140524-01"
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20140610-01"
|
||||
|
||||
/* macros for defining plugin infos */
|
||||
#define WEECHAT_PLUGIN_NAME(__name) \
|
||||
@ -832,7 +832,7 @@ struct t_weechat_plugin
|
||||
struct t_hashtable *hashtable);
|
||||
|
||||
/* infolists */
|
||||
struct t_infolist *(*infolist_new) ();
|
||||
struct t_infolist *(*infolist_new) (struct t_weechat_plugin *plugin);
|
||||
struct t_infolist_item *(*infolist_new_item) (struct t_infolist *infolist);
|
||||
struct t_infolist_var *(*infolist_new_var_integer) (struct t_infolist_item *item,
|
||||
const char *name,
|
||||
@ -1628,7 +1628,7 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
||||
|
||||
/* infolists */
|
||||
#define weechat_infolist_new() \
|
||||
weechat_plugin->infolist_new()
|
||||
weechat_plugin->infolist_new(weechat_plugin)
|
||||
#define weechat_infolist_new_item(__list) \
|
||||
weechat_plugin->infolist_new_item(__list)
|
||||
#define weechat_infolist_new_var_integer(__item, __name, __value) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user