Commit 02980bdca1c3398396466adff993746cac34fc08

Carlos Martín Nieto 2015-06-09T16:53:07

Initialize a few variables Coverity complains about the git_rawobj ones because we use a loop in which we keep remembering the old version, and we end up copying our object as the base, so we want to have the data pointer be NULL.

diff --git a/src/indexer.c b/src/indexer.c
index e39345c..ef2ac3c 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -822,7 +822,7 @@ static int resolve_deltas(git_indexer *idx, git_transfer_progress *stats)
 		progressed = 0;
 		non_null = 0;
 		git_vector_foreach(&idx->deltas, i, delta) {
-			git_rawobj obj;
+			git_rawobj obj = {NULL};
 
 			if (!delta)
 				continue;
diff --git a/src/odb_pack.c b/src/odb_pack.c
index 1757cf9..735158d 100644
--- a/src/odb_pack.c
+++ b/src/odb_pack.c
@@ -383,7 +383,7 @@ static int pack_backend__read_internal(
 	git_odb_backend *backend, const git_oid *oid)
 {
 	struct git_pack_entry e;
-	git_rawobj raw;
+	git_rawobj raw = {NULL};
 	int error;
 
 	if ((error = pack_entry_find(&e, (struct pack_backend *)backend, oid)) < 0 ||
diff --git a/src/rebase.c b/src/rebase.c
index b636e79..8da7b4f 100644
--- a/src/rebase.c
+++ b/src/rebase.c
@@ -512,7 +512,7 @@ static int rebase_ensure_not_dirty(
 	git_tree *head = NULL;
 	git_index *index = NULL;
 	git_diff *diff = NULL;
-	int error;
+	int error = 0;
 
 	if (check_index) {
 		if ((error = git_repository_head_tree(&head, repo)) < 0 ||