]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
fs/zfs: Fix another memory leak in ZFS code
authorGlenn Washburn <development@efficientek.com>
Mon, 5 May 2025 22:09:19 +0000 (17:09 -0500)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 29 May 2025 12:53:09 +0000 (14:53 +0200)
Commit b66c6f918 (fs/zfs: Fix a number of memory leaks in ZFS code)
fixes many of the same leaks detected in bug #63846 except one, which
is fixed here.

Fixes: https://savannah.gnu.org/bugs/?63846
Fixes: b66c6f918 (fs/zfs: Fix a number of memory leaks in ZFS code)
Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/fs/zfs/zfs.c

index bff9d0208b9f720c3b537fa8809e6d6470977243..afe821f9b4bc78c1cf3e1f8b48ba14bd110cc4e7 100644 (file)
@@ -3052,6 +3052,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
          void *sahdrp;
          int hdrsize;
          grub_size_t sz;
+         bool free_sahdrp = false;
 
          if (dnode_path->dn.dn.dn_bonuslen != 0)
            {
@@ -3064,6 +3065,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
              err = zio_read (bp, dnode_path->dn.endian, &sahdrp, NULL, data);
              if (err)
                break;
+             free_sahdrp = true;
            }
          else
            {
@@ -3122,6 +3124,9 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
                     }
              dn_new = dnode_path;
            }
+         if (free_sahdrp == true)
+           grub_free (sahdrp);
+
        }
     }