[Ocfs2-tools-devel] [PATCH] ocfs2-tools: Build related fixes

chuanchang.jia at gmail.com chuanchang.jia at gmail.com
Mon Sep 19 10:24:07 PDT 2011


fsck.ocfs2/journal.c: avoid missing 'jis' initial value.
fsck.ocfs2/pass1b.c, libocfs2/chainalloc.c: avoid missing 'ret' initial value.
libocfs2/dir_indexed.c: avoid missing 'blkno' initial value and memory leak.
mounted.ocfs2/mounted.c: avoid missing 'proc' initial value.

Signed-off-by: Alex Jia <chuanchang.jia at gmail.com>
---
 fsck.ocfs2/journal.c    |    2 +-
 fsck.ocfs2/pass1b.c     |    2 +-
 libocfs2/chainalloc.c   |    2 +-
 libocfs2/dir_indexed.c  |    3 ++-
 mounted.ocfs2/mounted.c |    2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/fsck.ocfs2/journal.c b/fsck.ocfs2/journal.c
index 3f87f4f..ff47633 100644
--- a/fsck.ocfs2/journal.c
+++ b/fsck.ocfs2/journal.c
@@ -602,7 +602,7 @@ out:
 errcode_t o2fsck_replay_journals(ocfs2_filesys *fs, int *replayed)
 {
 	errcode_t err = 0, ret = 0;
-	struct journal_info *jis, *ji;
+	struct journal_info *jis = NULL, *ji;
 	journal_superblock_t *jsb;
 	char *buf = NULL;
 	int journal_trouble = 0;
diff --git a/fsck.ocfs2/pass1b.c b/fsck.ocfs2/pass1b.c
index 6065340..3e01cfa 100644
--- a/fsck.ocfs2/pass1b.c
+++ b/fsck.ocfs2/pass1b.c
@@ -569,7 +569,7 @@ static int process_xattr_buckets(ocfs2_filesys *fs,
 				 int ref_recno,
 				 void *priv_data)
 {
-	errcode_t ret;
+	errcode_t ret = 0;
 	struct process_extents_context *pc = priv_data;
 
 	assert(!tree_depth);
diff --git a/libocfs2/chainalloc.c b/libocfs2/chainalloc.c
index 6ee353d..f886725 100644
--- a/libocfs2/chainalloc.c
+++ b/libocfs2/chainalloc.c
@@ -156,7 +156,7 @@ static errcode_t create_chainalloc_region(ocfs2_filesys *fs,
 					  struct ocfs2_group_desc *gd,
 					  struct chainalloc_bitmap_private *cb)
 {
-	errcode_t ret;
+	errcode_t ret = 0;
 	int total_bits = gd->bg_bits;
 	int region_bits = 0, bit_offset = 0, set_bits = 0;
 	uint64_t start_bit;
diff --git a/libocfs2/dir_indexed.c b/libocfs2/dir_indexed.c
index a195ea5..12a5620 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;
 }
 
@@ -1413,7 +1414,7 @@ errcode_t ocfs2_dx_dir_search(ocfs2_filesys *fs,
 	struct ocfs2_dx_entry *dx_entry;
 	struct ocfs2_dir_entry *dir_ent;
 	uint32_t leaf_cpos;
-	uint64_t blkno;
+	uint64_t blkno = 0;
 	int i, found;
 
 	if (dx_root->dr_flags & OCFS2_DX_FLAG_INLINE)
diff --git a/mounted.ocfs2/mounted.c b/mounted.ocfs2/mounted.c
index f76556c..383a9c8 100644
--- a/mounted.ocfs2/mounted.c
+++ b/mounted.ocfs2/mounted.c
@@ -259,7 +259,7 @@ static void free_partition_list(struct list_head *dev_list)
 static errcode_t build_partition_list(struct list_head *dev_list, char *device)
 {
 	errcode_t ret = 0;
-	FILE *proc;
+	FILE *proc = NULL;
 	char line[512];
 	char name[512];
 	char *devname = NULL;
-- 
1.7.1




More information about the Ocfs2-tools-devel mailing list