All of lore.kernel.org
 help / color / mirror / Atom feed
From: t.feng <fengtao40@huawei.com>
To: <grub-devel@gnu.org>
Cc: <fengtao40@huawei.com>, <daniel.kiper@oracle.com>,
	<yanan@huawei.com>, <zhaowei23@huawei.com>
Subject: [PATCH 2/9] fs/btrfs: Fix memory leak in find_path
Date: Sat, 19 Nov 2022 18:39:39 +0800	[thread overview]
Message-ID: <20221119103946.657744-3-fengtao40@huawei.com> (raw)
In-Reply-To: <20221119103946.657744-1-fengtao40@huawei.com>

Fix memory leak in find_path.

Fixs: 82591fa6e(Make / in btrfe refer to real root)

Signed-off-by: "t.feng" <fengtao40@huawei.com>
---
 grub-core/fs/btrfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index ec72f7be3..19bff4610 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -1982,7 +1982,12 @@ find_path (struct grub_btrfs_data *data,
 	    {
 	      err = get_root (data, key, tree, type);
 	      if (err)
-		return err;
+		{
+		  grub_free (direl);
+		  grub_free (path_alloc);
+		  grub_free (origpath);
+		  return err;
+		}
 	    }
 	  continue;
 	}
-- 
2.27.0



  parent reply	other threads:[~2022-11-19 10:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-19 10:39 [PATCH 0/9] fix memory leaks in fs module t.feng
2022-11-19 10:39 ` [PATCH 1/9] fs/affs:Fix memory leaks in grub_affs_create_node t.feng
2022-11-19 10:39 ` t.feng [this message]
2022-11-19 10:39 ` [PATCH 3/9] fs/minix: Fix memory leak in grub_minix_lookup_symlink t.feng
2022-11-23 15:10   ` Daniel Kiper
2022-11-19 10:39 ` [PATCH 4/9] fs/ntfs: Fix memory leak in grub_ntfs_read_symlink t.feng
2022-11-23 15:16   ` Daniel Kiper
2022-11-19 10:39 ` [PATCH 5/9] fs/bfs: Fix memory leak in read_bfs_file t.feng
2022-11-19 10:39 ` [PATCH 6/9] fs/hfsplus: Fix memory leak in grub_hfsplus_btree_search t.feng
2022-11-19 10:39 ` [PATCH 7/9] fs/iso9660: Fix memory leak in grub_iso9660_susp_iterate t.feng
2022-11-19 12:26   ` Thomas Schmitt
2022-11-19 10:39 ` [PATCH 8/9] fs/squash4: Fix memeory leak in grub_squash_iterate_dir t.feng
2022-11-19 10:39 ` [PATCH 9/9] fs/xfs: Fix memory leaks in xfs t.feng
2022-11-23 15:37 ` [PATCH 0/9] fix memory leaks in fs module Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221119103946.657744-3-fengtao40@huawei.com \
    --to=fengtao40@huawei.com \
    --cc=daniel.kiper@oracle.com \
    --cc=grub-devel@gnu.org \
    --cc=yanan@huawei.com \
    --cc=zhaowei23@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.