Fix several memory leaks.
This commit is contained in:
parent
c686014c1b
commit
03f7c8c304
13 changed files with 72 additions and 14 deletions
|
@ -139,6 +139,8 @@ grub_env_context_close (void)
|
|||
grub_current_context = context;
|
||||
|
||||
menu = current_menu->prev;
|
||||
if (current_menu->menu)
|
||||
grub_normal_free_menu (current_menu->menu);
|
||||
grub_free (current_menu);
|
||||
current_menu = menu;
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ grub_normal_free_menu (grub_menu_t menu)
|
|||
grub_free ((void *) entry->users);
|
||||
grub_free ((void *) entry->title);
|
||||
grub_free ((void *) entry->sourcecode);
|
||||
grub_free (entry);
|
||||
entry = next_entry;
|
||||
}
|
||||
|
||||
|
@ -191,6 +192,7 @@ read_config_file (const char *config)
|
|||
if (ptr)
|
||||
*ptr = 0;
|
||||
grub_env_set ("config_directory", config_dir);
|
||||
grub_free (config_dir);
|
||||
|
||||
grub_env_export ("config_file");
|
||||
grub_env_export ("config_directory");
|
||||
|
|
|
@ -517,7 +517,15 @@ destroy_screen (struct screen *screen)
|
|||
struct line *linep = screen->lines + i;
|
||||
|
||||
if (linep)
|
||||
grub_free (linep->buf);
|
||||
{
|
||||
unsigned j;
|
||||
if (linep->pos)
|
||||
for (j = 0; j < screen->nterms; j++)
|
||||
grub_free (linep->pos[j]);
|
||||
|
||||
grub_free (linep->buf);
|
||||
grub_free (linep->pos);
|
||||
}
|
||||
}
|
||||
|
||||
grub_free (screen->killed_text);
|
||||
|
|
|
@ -56,8 +56,10 @@ grub_getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position,
|
|||
while (str < last_position)
|
||||
{
|
||||
struct grub_unicode_glyph glyph;
|
||||
glyph.combining = 0;
|
||||
str += grub_unicode_aglomerate_comb (str, last_position - str, &glyph);
|
||||
width += grub_term_getcharwidth (term, &glyph);
|
||||
grub_free (glyph.combining);
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
@ -396,6 +398,7 @@ menu_text_print_timeout (int timeout, void *dataptr)
|
|||
}
|
||||
|
||||
grub_print_message_indented (msg_translated, 3, 0, data->term);
|
||||
grub_free (msg_translated);
|
||||
|
||||
posx = grub_term_getxy (data->term) >> 8;
|
||||
grub_print_spaces (data->term, grub_term_width (data->term) - posx - 1);
|
||||
|
@ -447,7 +450,7 @@ menu_text_fini (void *dataptr)
|
|||
|
||||
grub_term_setcursor (data->term, 1);
|
||||
grub_term_cls (data->term);
|
||||
|
||||
grub_free (data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -952,6 +952,8 @@ print_ucs4_real (const grub_uint32_t * str,
|
|||
ret++;
|
||||
if (visual_len_show && visual[visual_len_show - 1].base != '\n')
|
||||
ret++;
|
||||
for (vptr = visual; vptr < visual + visual_len; vptr++)
|
||||
grub_free (vptr->combining);
|
||||
grub_free (visual);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue