linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hfs: fix a memleak in hfs_find_init
@ 2024-01-22 17:27 Zhipeng Lu
  2024-01-26 15:02 ` Viacheslav Dubeyko
  0 siblings, 1 reply; 5+ messages in thread
From: Zhipeng Lu @ 2024-01-22 17:27 UTC (permalink / raw)
  To: alexious
  Cc: Andrew Morton, Desmond Cheong Zhi Xi, Viacheslav Dubeyko,
	linux-fsdevel, linux-kernel

When the switch statment goes to default and return an error, ptr should
be freed since it is allocated in hfs_find_init.

Fixes: b3b2177a2d79 ("hfs: add lock nesting notation to hfs_find_init")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
---
 fs/hfs/bfind.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
index ef9498a6e88a..7aa3b9aba4d1 100644
--- a/fs/hfs/bfind.c
+++ b/fs/hfs/bfind.c
@@ -36,6 +36,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd)
 		mutex_lock_nested(&tree->tree_lock, ATTR_BTREE_MUTEX);
 		break;
 	default:
+		kfree(fd->search_key);
 		return -EINVAL;
 	}
 	return 0;
-- 
2.34.1


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

end of thread, other threads:[~2024-01-29 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-22 17:27 [PATCH] hfs: fix a memleak in hfs_find_init Zhipeng Lu
2024-01-26 15:02 ` Viacheslav Dubeyko
2024-01-29 12:54   ` alexious
2024-01-29 14:25     ` Viacheslav Dubeyko
2024-01-29 15:17       ` alexious

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