udf: Fix memory leak
Fixes: CID 73796 Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> Reviewed-by: Jan Setje-Eilers <jan.setjeeilers@oracle.com>
This commit is contained in:
parent
61b7ca08d1
commit
d17770857e
1 changed files with 13 additions and 4 deletions
|
@ -965,8 +965,10 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (grub_udf_read_icb (dir->data, &dirent.icb, child))
|
if (grub_udf_read_icb (dir->data, &dirent.icb, child))
|
||||||
return 0;
|
{
|
||||||
|
grub_free (child);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (dirent.characteristics & GRUB_UDF_FID_CHAR_PARENT)
|
if (dirent.characteristics & GRUB_UDF_FID_CHAR_PARENT)
|
||||||
{
|
{
|
||||||
/* This is the parent directory. */
|
/* This is the parent directory. */
|
||||||
|
@ -988,11 +990,18 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,
|
||||||
dirent.file_ident_length,
|
dirent.file_ident_length,
|
||||||
(char *) raw))
|
(char *) raw))
|
||||||
!= dirent.file_ident_length)
|
!= dirent.file_ident_length)
|
||||||
return 0;
|
{
|
||||||
|
grub_free (child);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
filename = read_string (raw, dirent.file_ident_length, 0);
|
filename = read_string (raw, dirent.file_ident_length, 0);
|
||||||
if (!filename)
|
if (!filename)
|
||||||
grub_print_error ();
|
{
|
||||||
|
/* As the hook won't get called. */
|
||||||
|
grub_free (child);
|
||||||
|
grub_print_error ();
|
||||||
|
}
|
||||||
|
|
||||||
if (filename && hook (filename, type, child, hook_data))
|
if (filename && hook (filename, type, child, hook_data))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue