[Ocfs2-tools-devel] [PATCH] o2image: Free 'filepath' before return in prompt_image_creation()
piaojun
piaojun at huawei.com
Wed Jul 13 17:42:50 PDT 2016
A memory leak problem is found in prompt_image_creation(), 'filepath'
need to be freed before return.
Signed-off-by: Jun Piao <piaojun at huawei.com>
Reviewed-by: Joseph Qi <joseph.qi at huawei.com>
---
o2image/o2image.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/o2image/o2image.c b/o2image/o2image.c
index 465e7fe..ce70fcb 100644
--- a/o2image/o2image.c
+++ b/o2image/o2image.c
@@ -674,9 +674,11 @@ static int prompt_image_creation(ocfs2_filesys *ofs, int rawflg, char *filename)
img_size/1024, free_spc/1024);
if (toupper(getchar()) != 'Y') {
fprintf(stdout, "Aborting image creation.\n");
+ ocfs2_free(&filepath);
return 0;
}
+ ocfs2_free(&filepath);
return 1;
}
--
1.8.4.3
More information about the Ocfs2-tools-devel
mailing list