diff options
author | Vicent Martà <tanoku@gmail.com> | 2012-01-05 17:46:06 -0800 |
---|---|---|
committer | Vicent Martà <tanoku@gmail.com> | 2012-01-05 17:46:06 -0800 |
commit | 1d175074969ea47fdaca95cf9912fa2e74aa156e (patch) | |
tree | e17343ca755ef358c400849e72ee9e86adc22c71 /src | |
parent | 91d46f8df3802245a5bc200fb57d9f2076c280b4 (diff) | |
parent | fa3cb0dae079f0f0d4b3f7e6e5eb560627e97eac (diff) | |
download | libgit2-1d175074969ea47fdaca95cf9912fa2e74aa156e.tar.gz |
Merge pull request #528 from arrbee/valgrind-fixes-2
Valgrind fixes in smaller pieces
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 2 | ||||
-rw-r--r-- | src/index.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c index 1338ef3b1..a0ae4cb5b 100644 --- a/src/config.c +++ b/src/config.c @@ -120,7 +120,7 @@ int git_config_add_file(git_config *cfg, git_config_file *file, int priority) assert(cfg && file); if ((error = file->open(file)) < GIT_SUCCESS) - return git__rethrow(error, "Failed to open config file"); + return git__throw(error, "Failed to open config file"); internal = git__malloc(sizeof(file_internal)); if (internal == NULL) diff --git a/src/index.c b/src/index.c index 9f9a08f0d..9e88012bb 100644 --- a/src/index.c +++ b/src/index.c @@ -510,6 +510,7 @@ int git_index_append2(git_index *index, const git_index_entry *source_entry) int git_index_remove(git_index *index, int position) { + int error; git_index_entry *entry; git_vector_sort(&index->entries); @@ -517,7 +518,12 @@ int git_index_remove(git_index *index, int position) if (entry != NULL) git_tree_cache_invalidate_path(index->tree, entry->path); - return git_vector_remove(&index->entries, (unsigned int)position); + error = git_vector_remove(&index->entries, (unsigned int)position); + + if (error == GIT_SUCCESS) + index_entry_free(entry); + + return error; } int git_index_find(git_index *index, const char *path) |