Merge pull request #4774 from tiennou/fix/clang-analyzer Coverity flavored clang analyzer fixes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
diff --git a/src/mailmap.c b/src/mailmap.c
index fe4d452..1f725b3 100644
--- a/src/mailmap.c
+++ b/src/mailmap.c
@@ -225,7 +225,7 @@ int git_mailmap_add_entry(
static int mailmap_add_buffer(git_mailmap *mm, const char *buf, size_t len)
{
- int error;
+ int error = 0;
git_parse_ctx ctx;
/* Scratch buffers containing the real parsed names & emails */
diff --git a/src/remote.c b/src/remote.c
index ca73ede..9c0e88a 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -428,7 +428,7 @@ static int get_optional_config(
int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
{
- git_remote *remote;
+ git_remote *remote = NULL;
git_buf buf = GIT_BUF_INIT;
const char *val;
int error = 0;
@@ -510,7 +510,7 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
if ((error = get_optional_config(NULL, config, &buf, refspec_cb, &data)) < 0)
goto cleanup;
- if (download_tags_value(remote, config) < 0)
+ if ((error = download_tags_value(remote, config)) < 0)
goto cleanup;
if ((error = lookup_remote_prune_config(remote, config, name)) < 0)
diff --git a/src/revwalk.c b/src/revwalk.c
index be647af..da84a44 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -550,7 +550,7 @@ cleanup:
static int prepare_walk(git_revwalk *walk)
{
- int error;
+ int error = 0;
git_commit_list *list, *commits = NULL;
git_commit_list_node *next;
diff --git a/src/transports/http.c b/src/transports/http.c
index ea3e57a..bc3ab18 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -142,7 +142,7 @@ static int auth_context_match(
}
if (!scheme)
- return 0;
+ return -1;
/* See if authentication has already started for this scheme */
git_vector_foreach(&t->auth_contexts, i, c) {