fs/zfs: Fix a number of memory leaks in ZFS code

Without this fix the GRUB failed to boot linux with "out of memory" after
trying to run a "search --fs-uuid..." on a system that has 7 ZFS pools
across about 80 drives.

Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Stuart Hayes authored and Daniel Kiper committed 2025-03-26 14:34:44 +01:00
1 parent 1d59f39b5f
commit b66c6f9182
2 files changed
+42 -6

No files matched your search

+4 -1
View File
@@ -379,14 +379,17 @@ grub_cmd_zfs_bootfs (grub_command_t cmd __attribute__ ((unused)), int argc,
grub_device_close (dev);
if (err)
if (err) {
grub_free (nvlist);
return err;
}
poolname = grub_zfs_nvlist_lookup_string (nvlist, ZPOOL_CONFIG_POOL_NAME);
if (!poolname)
{
if (!grub_errno)
grub_error (GRUB_ERR_BAD_FS, "No poolname found");
grub_free (nvlist);
return grub_errno;
}