Skip to contentSkip to conversation

ocfs2: free path in ocfs2_remove_inode_range()

PATCH New Younger Liu 2 participants 2 messages Aug 2, 2013 – Aug 6, 2013 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ocfs2: free path in ocfs2_remove_inode_range()

In ocfs2_remove_inode_range(), there is a memory leak.
The variable path has allocated memory with ocfs2_new_path_from_et(), but it is not free.

---
 fs/ocfs2/file.c |    1 +
 1 file changed, 1 insertion(+)
fs/ocfs2/file.c +1 -0
index 833a09b..2d1a227 100644
@@ -1796,6 +1796,7 @@ static int ocfs2_remove_inode_range(struct inode *inode,
 	ocfs2_truncate_cluster_pages(inode, byte_start, byte_len);
 
 out:
+	ocfs2_free_path(path);
 	ocfs2_schedule_truncate_log_flush(osb, 1);
 	ocfs2_run_deallocs(osb, &dealloc);
 
Signature · 1 line
1.7.9.7
#1 lore raw

PATCH 1/1 ocfs2: free path in ocfs2_remove_inode_range()

Quoted 14 lines · Younger Liu

In ocfs2_remove_inode_range(), there is a memory leak.
The variable path has allocated memory with ocfs2_new_path_from_et(), but it is not free.

---
 fs/ocfs2/file.c |    1 +
 1 file changed, 1 insertion(+)
fs/ocfs2/file.c +0 -0
index 833a09b..2d1a227 100644

fs/ocfs2/file.c static int ocfs2_remove_inode_range(struct inode *inode, · line 1801

Quoted 6 lines
fs/ocfs2/file.c +1 -0
@@ -1796,6 +1796,7 @@ static int ocfs2_remove_inode_range(struct inode *inode,
 	ocfs2_truncate_cluster_pages(inode, byte_start, byte_len);
 
 out:
+	ocfs2_free_path(path);
 	ocfs2_schedule_truncate_log_flush(osb, 1);
 	ocfs2_run_deallocs(osb, &dealloc);

This patch looks good to me.

BTW, I found another similar problem at: ocfs2/move_extent.c->__ocfs2_move_extent() with a simple grep against the source tree, will post a patch to fix it, would you like to help review?

Thanks,
-Jeff