linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Hu Weiwen <sehuww@mail.scut.edu.cn>
To: sehuww@mail.scut.edu.cn
Cc: linux-erofs@lists.ozlabs.org
Subject: [PATCH v2] erofs-utils: fix memory leak when erofs_fill_inode() fails
Date: Tue, 19 Jan 2021 14:11:23 +0800	[thread overview]
Message-ID: <20210119061123.9774-1-sehuww@mail.scut.edu.cn> (raw)
In-Reply-To: <20210118124033.23888-1-sehuww@mail.scut.edu.cn>

Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
---
fixes a typo in v1

 lib/inode.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/inode.c b/lib/inode.c
index d6a64cc..6f6e984 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -868,9 +868,13 @@ struct erofs_inode *erofs_iget_from_path(const char *path, bool is_src)

 	ret = erofs_fill_inode(inode, &st, path);
 	if (ret)
-		return ERR_PTR(ret);
+		goto err;

 	return inode;
+
+err:
+	free(inode);
+	return ERR_PTR(ret);
 }

 void erofs_fixup_meta_blkaddr(struct erofs_inode *rootdir)
--
2.30.0


  reply	other threads:[~2021-01-19  6:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 12:40 [PATCH] erofs-utils: fix memory leak when erofs_fill_inode() fails Hu Weiwen
2021-01-19  6:11 ` Hu Weiwen [this message]
2021-01-19 15:36   ` [PATCH v2] " Gao Xiang
2021-01-21 16:21     ` [PATCH v3] " Hu Weiwen
2021-01-22  2:00       ` Gao Xiang
2021-02-06 14:04       ` Li GuiFu via Linux-erofs

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=20210119061123.9774-1-sehuww@mail.scut.edu.cn \
    --to=sehuww@mail.scut.edu.cn \
    --cc=linux-erofs@lists.ozlabs.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).