linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: fix memory leak when erofs_fill_inode() fails
@ 2021-01-18 12:40 Hu Weiwen
  2021-01-19  6:11 ` [PATCH v2] " Hu Weiwen
  0 siblings, 1 reply; 6+ messages in thread
From: Hu Weiwen @ 2021-01-18 12:40 UTC (permalink / raw)
  To: Gao Xiang, linux-erofs; +Cc: Hu Weiwen

Signeo-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-06 14:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-18 12:40 [PATCH] erofs-utils: fix memory leak when erofs_fill_inode() fails Hu Weiwen
2021-01-19  6:11 ` [PATCH v2] " Hu Weiwen
2021-01-19 15:36   ` 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

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).