Fix a few valgrind errors

This commit is contained in:
Carlos Martín Nieto 2012-11-13 16:13:10 -08:00
parent 513e794ef4
commit 6132a54e0b
3 changed files with 5 additions and 2 deletions

View File

@ -436,7 +436,7 @@ int git_config_get_bool(int *out, git_config *cfg, const char *name)
int git_config_get_string(const char **out, git_config *cfg, const char *name) int git_config_get_string(const char **out, git_config *cfg, const char *name)
{ {
int ret; int ret;
const char *str; const char *str = NULL;
if ((ret = get_string(&str, cfg, name)) < 0) if ((ret = get_string(&str, cfg, name)) < 0)
return ret; return ret;

View File

@ -1098,7 +1098,8 @@ static int read_reuc(git_index *index, const char *buffer, size_t size)
size_t len; size_t len;
int i; int i;
if (git_vector_init(&index->reuc, 16, reuc_cmp) < 0) /* This gets called multiple times, the vector might already be initialized */
if (index->reuc._alloc_size == 0 && git_vector_init(&index->reuc, 16, reuc_cmp) < 0)
return -1; return -1;
while (size) { while (size) {

View File

@ -227,6 +227,8 @@ static int local_negotiate_fetch(
git_oid_cpy(&rhead->loid, git_object_id(obj)); git_oid_cpy(&rhead->loid, git_object_id(obj));
else if (error != GIT_ENOTFOUND) else if (error != GIT_ENOTFOUND)
return error; return error;
else
memset(&rhead->loid, 0, sizeof(git_oid));
git_object_free(obj); git_object_free(obj);
giterr_clear(); giterr_clear();
} }