Commit a166466c by Edward Thomson

Merge pull request #3198 from libgit2/cmn/coverity

A few fixes from Coverity
parents 82a7a24c 02980bdc
......@@ -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;
......
......@@ -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 ||
......
......@@ -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 ||
......
......@@ -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) {
......
......@@ -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,7 +622,6 @@ static int _git_ssh_setup_conn(
done:
if (error < 0) {
if (*stream)
ssh_stream_free(*stream);
if (session)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment