[Ocfs2-tools-devel] [PATCH v2] o2image: fix a memory leak problem in ocfs2_image_free_bitmap()

piaojun piaojun at huawei.com
Sat Jul 30 01:33:13 PDT 2016


whether OCFS2_FLAG_IMAGE_FILE is set or not, we will allocate image
bitmaps by ocfs2_image_alloc_bitmap(), so we should free them in
ocfs2_image_free_bitmap() anyway.

Signed-off-by: Jun Piao <piaojun at huawei.com>
Reviewed-by: Joseph Qi <joseph.qi at huawei.com>
---
 libocfs2/image.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/libocfs2/image.c b/libocfs2/image.c
index 41d1a53..fe95530 100644
--- a/libocfs2/image.c
+++ b/libocfs2/image.c
@@ -66,10 +66,6 @@ errcode_t ocfs2_image_free_bitmap(ocfs2_filesys *ofs)
 	struct ocfs2_image_state *ost = ofs->ost;
 	int i;
 
-	/* image bitmaps are allocated only for ocfs2 image image files */
-	if (!(ofs->fs_flags & OCFS2_FLAG_IMAGE_FILE))
-		return 0;
-
 	if (!ost->ost_bmparr)
 		return 0;
 
-- 
1.8.4.3




More information about the Ocfs2-tools-devel mailing list