mirror of
https://git.proxmox.com/git/grub2
synced 2025-07-20 18:23:51 +00:00
util/grub-install: rearrange code to avoid memory leak.
Found by: Coverity scan.
This commit is contained in:
parent
e61f4eba18
commit
be0743b052
@ -615,17 +615,14 @@ device_map_check_duplicates (const char *dev_map)
|
|||||||
char **d;
|
char **d;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
d = xmalloc (alloced * sizeof (d[0]));
|
|
||||||
|
|
||||||
if (dev_map[0] == '\0')
|
if (dev_map[0] == '\0')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fp = grub_util_fopen (dev_map, "r");
|
fp = grub_util_fopen (dev_map, "r");
|
||||||
if (! fp)
|
if (! fp)
|
||||||
{
|
|
||||||
free (d);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
d = xmalloc (alloced * sizeof (d[0]));
|
||||||
|
|
||||||
while (fgets (buf, sizeof (buf), fp))
|
while (fgets (buf, sizeof (buf), fp))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user