On Mon, Jul 15, 2013 at 07:36:50PM +0800, Wang Shilong wrote:
valgrind complains open_file_or_dir() causes a memory leak.That is because
if we open a directoy by opendir(), and then we should call closedir()
to free memory.
I've reviewed this and don't see a better way how to fix the leaks
--- a/utils.c
+++ b/utils.c
@@ -1476,11 +1475,11 @@ u64 parse_size(char *s)
return strtoull(s, NULL, 10) * mult;
}
-int open_file_or_dir(const char *fname)
+int open_file_or_dir(const char *fname, DIR **dirstream)
{
int ret;
struct stat st;
- DIR *dirstream =
From: Wang Shilong wangsl.f...@cn.fujitsu.com
valgrind complains open_file_or_dir() causes a memory leak.That is because
if we open a directoy by opendir(), and then we should call closedir()
to free memory.
Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com
---
btrfs-fragments.c | 4 +++-