summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-07-13 06:18:24 -0700
committerVicent Martí <vicent@github.com>2013-07-13 06:18:24 -0700
commit1662158cf98ce32827f3857fd9559a1b0e6223ed (patch)
treec84b5ffaacae178d6d6537f6f021e9217049bcaf
parent3a025b97ffdf5f5f633d6d6d9b13f0974fa8052f (diff)
parentd6cb13d7436793718f103687fe95d0f881487ad0 (diff)
downloadlibgit2-1662158cf98ce32827f3857fd9559a1b0e6223ed.tar.gz
Merge pull request #1725 from libgit2/ntk/fix/leaks
Plug some memory leaks
-rw-r--r--src/submodule.c3
-rw-r--r--tests-clar/diff/pathspec.c1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/submodule.c b/src/submodule.c
index b5dacc42e..b4e917561 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -798,7 +798,7 @@ static void submodule_update_from_head_data(
static int submodule_update_head(git_submodule *submodule)
{
git_tree *head = NULL;
- git_tree_entry *te;
+ git_tree_entry *te = NULL;
submodule->flags = submodule->flags &
~(GIT_SUBMODULE_STATUS_IN_HEAD |
@@ -811,6 +811,7 @@ static int submodule_update_head(git_submodule *submodule)
else
submodule_update_from_head_data(submodule, te->attr, &te->oid);
+ git_tree_entry_free(te);
git_tree_free(head);
return 0;
}
diff --git a/tests-clar/diff/pathspec.c b/tests-clar/diff/pathspec.c
index 4334a8901..7b15ea04c 100644
--- a/tests-clar/diff/pathspec.c
+++ b/tests-clar/diff/pathspec.c
@@ -89,4 +89,5 @@ void test_diff_pathspec__0(void)
git_tree_free(a);
git_tree_free(b);
+ git_pathspec_free(ps);
}