[Ocfs2-tools-devel] [PATCH] libocfs2: avoid memory leak

chuanchang.jia at gmail.com chuanchang.jia at gmail.com
Mon Sep 19 07:54:58 PDT 2011


libocfs2/dir_indexed.c: calling allocation function 'ocfs2_dx_dir_alloc_leaves'
to allocate memory to 'dx_leaves' and then taking 'if (ret)' true branch, the
codes will jump into 'out' section, however, 'dx_leaves' hasn't been released.

Signed-off-by: Alex Jia <chuanchang.jia at gmail.com>
---
 libocfs2/dir_indexed.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/libocfs2/dir_indexed.c b/libocfs2/dir_indexed.c
index a195ea5..a5d21a1 100644
--- a/libocfs2/dir_indexed.c
+++ b/libocfs2/dir_indexed.c
@@ -429,6 +429,7 @@ static errcode_t ocfs2_expand_inline_dx_root(ocfs2_filesys *fs,
 		goto out;
 
 out:
+	ocfs2_free(&dx_leaves);
 	return ret;
 }
 
-- 
1.7.1




More information about the Ocfs2-tools-devel mailing list