[config] Fix memory leak in widget handling

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-04-28 21:58:19 +02:00
parent 84df60e11b
commit 20ad84d972
1 changed files with 3 additions and 3 deletions

View File

@ -243,8 +243,7 @@ statusbar_widgets_create(cfg_t *cfg_statusbar, Statusbar *statusbar)
for(i = 0; WidgetList[i].name; i++)
numwidgets += cfg_size(cfg_statusbar, WidgetList[i].name);
widgets = p_new(cfg_t, numwidgets);
wptr = widgets;
wptr = widgets = p_new(cfg_t, numwidgets);
for(i = 0; WidgetList[i].name; i++)
for (j = 0; j < cfg_size(cfg_statusbar, WidgetList[i].name); j++)
@ -259,7 +258,7 @@ statusbar_widgets_create(cfg_t *cfg_statusbar, Statusbar *statusbar)
for(i = 0; i < numwidgets; i++)
{
wptr = widgets + i;
wptr = &widgets[i];
widget_new = name_func_lookup(cfg_name(wptr), WidgetList);
if(widget_new)
{
@ -271,6 +270,7 @@ statusbar_widgets_create(cfg_t *cfg_statusbar, Statusbar *statusbar)
else
warn("ignoring unknown widget: %s.\n", cfg_name(widgets + i));
}
p_delete(&widgets);
}
static void