diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2015-06-09 17:06:28 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-06-09 17:06:28 -0400 |
commit | a166466cd199a1c4e374af1f6985b2572e261da0 (patch) | |
tree | 76108da685e702e807d9ac16ee2c1dee421262c5 | |
parent | 82a7a24cf4a40ed94a4dc05ee2d91733e506ac1c (diff) | |
parent | 02980bdca1c3398396466adff993746cac34fc08 (diff) | |
download | libgit2-a166466cd199a1c4e374af1f6985b2572e261da0.tar.gz |
Merge pull request #3198 from libgit2/cmn/coverity
A few fixes from Coverity
-rw-r--r-- | src/indexer.c | 2 | ||||
-rw-r--r-- | src/odb_pack.c | 2 | ||||
-rw-r--r-- | src/rebase.c | 2 | ||||
-rw-r--r-- | src/remote.c | 5 | ||||
-rw-r--r-- | src/transports/ssh.c | 10 |
5 files changed, 11 insertions, 10 deletions
diff --git a/src/indexer.c b/src/indexer.c index e39345c71..ef2ac3cba 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 1757cf920..735158d96 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 b636e7951..8da7b4f7f 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 || diff --git a/src/remote.c b/src/remote.c index b7acbb9c1..63f6d3462 100644 --- a/src/remote.c +++ b/src/remote.c @@ -869,7 +869,7 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs, const { int error = -1; size_t i; - git_vector refs, specs, *to_active; + git_vector *to_active, specs = GIT_VECTOR_INIT, refs = GIT_VECTOR_INIT; const git_remote_callbacks *cbs = NULL; assert(remote); @@ -2451,7 +2451,8 @@ char *apply_insteadof(git_config *config, const char *url, int direction) suffix_length = strlen(SUFFIX_PUSH) + 1; } - git_config_iterator_glob_new(&iter, config, regexp); + if (git_config_iterator_glob_new(&iter, config, regexp) < 0) + return NULL; match_length = 0; while (git_config_next(&entry, iter) == 0) { diff --git a/src/transports/ssh.c b/src/transports/ssh.c index 5c8545fe1..83af137f8 100644 --- a/src/transports/ssh.c +++ b/src/transports/ssh.c @@ -177,11 +177,12 @@ static int ssh_stream_write( static void ssh_stream_free(git_smart_subtransport_stream *stream) { ssh_stream *s = (ssh_stream *)stream; - ssh_subtransport *t = OWNING_SUBTRANSPORT(s); - int ret; + ssh_subtransport *t; - GIT_UNUSED(ret); + if (!stream) + return; + t = OWNING_SUBTRANSPORT(s); t->current_stream = NULL; if (s->channel) { @@ -621,8 +622,7 @@ static int _git_ssh_setup_conn( done: if (error < 0) { - if (*stream) - ssh_stream_free(*stream); + ssh_stream_free(*stream); if (session) libssh2_session_free(session); |