🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: org.gnu.grub-devel
1 messages
1 total messages Started by Glenn Washburn Mon, 05 May 2025 22:09
[PATCH] fs/zfs: Fix another memory leak in ZFS code
#1
Author: Glenn Washburn
Date: Mon, 05 May 2025 22:09
31 lines
7000 bytes
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
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
Reviewing some of the bugs on Savannah, I noticed #63846 which, apparently,
independently fixes some of the same leaks as fixed in the more recent
commit b66c6f918. The one change in the Savannah bug patch that I did not find
in b66c6f918 is the one here. The fix has been modified from the original
patch to be in the style of the other similar fixes in b66c6f918.

Glenn
---
 grub-core/fs/zfs/zfs.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
index bff9d0208b9f..8036b2e31cc5 100644
--- a/grub-core/fs/zfs/zfs.c
+++ b/grub-core/fs/zfs/zfs.c
@@ -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)
+	    grub_free (sahdrp);
+
 	}
     }
 
-- 
2.34.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads