nativedisk: fix memory leak
Based on Coverity scan. CID: 96660 Extended to also cover other error return places.
This commit is contained in:
parent
8fe17d91af
commit
1bff60e5aa
1 changed files with 11 additions and 1 deletions
|
@ -198,7 +198,10 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
if (get_uuid (NULL, &uuid_root, 0))
|
if (get_uuid (NULL, &uuid_root, 0))
|
||||||
|
{
|
||||||
|
grub_free (mods);
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
}
|
||||||
|
|
||||||
prefdev = grub_file_get_device_name (prefix);
|
prefdev = grub_file_get_device_name (prefix);
|
||||||
if (grub_errno)
|
if (grub_errno)
|
||||||
|
@ -210,6 +213,8 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
|
||||||
if (get_uuid (prefdev, &uuid_prefix, 0))
|
if (get_uuid (prefdev, &uuid_prefix, 0))
|
||||||
{
|
{
|
||||||
grub_free (uuid_root);
|
grub_free (uuid_root);
|
||||||
|
grub_free (prefdev);
|
||||||
|
grub_free (mods);
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,12 +294,15 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
|
||||||
}
|
}
|
||||||
grub_free (uuid_root);
|
grub_free (uuid_root);
|
||||||
grub_free (uuid_prefix);
|
grub_free (uuid_prefix);
|
||||||
|
grub_free (prefdev);
|
||||||
|
grub_free (mods);
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
grub_free (uuid_root);
|
grub_free (uuid_root);
|
||||||
grub_free (uuid_prefix);
|
grub_free (uuid_prefix);
|
||||||
|
grub_free (prefdev);
|
||||||
|
|
||||||
for (i = 0; i < mods_loaded; i++)
|
for (i = 0; i < mods_loaded; i++)
|
||||||
if (mods[i])
|
if (mods[i])
|
||||||
|
@ -302,6 +310,8 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
|
||||||
mods[i]->fini = 0;
|
mods[i]->fini = 0;
|
||||||
grub_dl_unload (mods[i]);
|
grub_dl_unload (mods[i]);
|
||||||
}
|
}
|
||||||
|
grub_free (mods);
|
||||||
|
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue