commands/fileXX: Fix memory leak.
Found by: Coverity Scan.
This commit is contained in:
parent
b04c6d32ce
commit
95a8c9182b
1 changed files with 6 additions and 3 deletions
|
@ -40,10 +40,10 @@ grub_file_check_netbsdXX (grub_elf_t elf)
|
|||
return 0;
|
||||
|
||||
if (grub_file_seek (elf->file, elf->ehdr.ehdrXX.e_shoff) == (grub_off_t) -1)
|
||||
return 0;
|
||||
goto fail;
|
||||
|
||||
if (grub_file_read (elf->file, s0, shsize) != (grub_ssize_t) shsize)
|
||||
return 0;
|
||||
goto fail;
|
||||
|
||||
s = (Elf_Shdr *) ((char *) s0 + elf->ehdr.ehdrXX.e_shstrndx * shentsize);
|
||||
stroff = s->sh_offset;
|
||||
|
@ -59,13 +59,16 @@ grub_file_check_netbsdXX (grub_elf_t elf)
|
|||
if (grub_file_read (elf->file, name, sizeof (name)) != (grub_ssize_t) sizeof (name))
|
||||
{
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
goto fail;
|
||||
continue;
|
||||
}
|
||||
if (grub_memcmp (name, ".note.netbsd.ident",
|
||||
sizeof(".note.netbsd.ident")) != 0)
|
||||
continue;
|
||||
grub_free (s0);
|
||||
return 1;
|
||||
}
|
||||
fail:
|
||||
grub_free (s0);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue