Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2011-07-14 05:03:12 +0400
committerVicent Martí <tanoku@gmail.com>2011-07-14 05:03:12 +0400
commit324f0eecb63da00e26977f3fe7561756df91b2d2 (patch)
treed136aa1d7a55eb32006e3fd890bf8e714fad89e0
parent18bdba0e1a1777f01f13ba24ed4c79e438aea218 (diff)
parent1a8167afbc2554677383b4275b37cc7c7ca61478 (diff)
Merge pull request #325 from carlosmn/valgrind
More memory leaks
-rw-r--r--src/status.c7
-rw-r--r--tests/t10-refs.c1
2 files changed, 5 insertions, 3 deletions
diff --git a/src/status.c b/src/status.c
index 97a285502..3e46ea873 100644
--- a/src/status.c
+++ b/src/status.c
@@ -90,6 +90,7 @@ static void recurse_tree_entries(git_tree *tree, git_vector *entries, char *path
if (git_tree_lookup(&subtree, tree->object.repo, &tree_entry->oid) == GIT_SUCCESS) {
recurse_tree_entries(subtree, entries, file_path);
+ git_tree_close(subtree);
return;
}
@@ -100,8 +101,6 @@ static void recurse_tree_entries(git_tree *tree, git_vector *entries, char *path
git_oid_cpy(&e->head_oid, &tree_entry->oid);
}
-
- git_tree_close(tree);
}
static void recurse_tree_entry(git_tree *tree, struct status_entry *e, const char *path)
@@ -121,6 +120,7 @@ static void recurse_tree_entry(git_tree *tree, struct status_entry *e, const cha
if (tree_entry != NULL) {
if (git_tree_lookup(&subtree, tree->object.repo, &tree_entry->oid) == GIT_SUCCESS) {
recurse_tree_entry(subtree, e, dir_sep+1);
+ git_tree_close(subtree);
return;
}
}
@@ -130,7 +130,6 @@ static void recurse_tree_entry(git_tree *tree, struct status_entry *e, const cha
if (tree_entry != NULL) {
git_oid_cpy(&e->head_oid, &tree_entry->oid);
}
- git_tree_close(tree);
}
struct status_st {
@@ -277,6 +276,7 @@ int git_status_foreach(git_repository *repo, int (*callback)(const char *, unsig
// recurse through tree entries
git_commit_tree(&tree, head_commit);
recurse_tree_entries(tree, &entries, "");
+ git_tree_close(tree);
git_commit_close(head_commit);
dirent_st.workdir_path_len = strlen(repo->path_workdir);
@@ -342,6 +342,7 @@ int git_status_file(unsigned int *status_flags, git_repository *repo, const char
git_commit_tree(&tree, head_commit);
recurse_tree_entry(tree, e, path);
+ git_tree_close(tree);
git_commit_close(head_commit);
// Find file in Workdir
diff --git a/tests/t10-refs.c b/tests/t10-refs.c
index aab21dea8..f151b5a46 100644
--- a/tests/t10-refs.c
+++ b/tests/t10-refs.c
@@ -1064,6 +1064,7 @@ BEGIN_TEST(reflog0, "write a reflog for a given reference and ensure it can be r
must_be_true(strcmp(current_master_tip, entry->oid_cur) == 0);
must_be_true(strcmp(commit_msg, entry->msg) == 0);
+ git_signature_free(committer);
git_reflog_free(reflog);
close_temp_repo(repo2);
END_TEST