diff options
| author | Vicent Martà <tanoku@gmail.com> | 2011-08-02 10:44:50 -0700 |
|---|---|---|
| committer | Vicent Martà <tanoku@gmail.com> | 2011-08-02 10:44:50 -0700 |
| commit | 03d88ed415a09faf161d8a081c18f51826be584a (patch) | |
| tree | c3c9674387e747bcd4401ec2c5816241ca43f87e /tests | |
| parent | 80de9ae03c82b6c7f3d313edc1db72b81ad01916 (diff) | |
| parent | 7d3ec3caac1ed10faecaf828b481b0f4958755c1 (diff) | |
| download | libgit2-03d88ed415a09faf161d8a081c18f51826be584a.tar.gz | |
Merge pull request #346 from belkiss/development
Fix memory leak when wrong object type is looked up from cache
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/t09-tree.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/t09-tree.c b/tests/t09-tree.c index be21e4e33..543aea8d4 100644 --- a/tests/t09-tree.c +++ b/tests/t09-tree.c @@ -104,9 +104,11 @@ BEGIN_TEST(read1, "read a tree from the repository") /* GH-86: git_object_lookup() should also check the type if the object comes from the cache */ must_be_true(git_object_lookup(&obj, repo, &id, GIT_OBJ_TREE) == 0); + must_be_true(obj != NULL); git_object_close(obj); + obj = NULL; must_be_true(git_object_lookup(&obj, repo, &id, GIT_OBJ_BLOB) == GIT_EINVALIDTYPE); - git_object_close(obj); + must_be_true(obj == NULL); entry = git_tree_entry_byname(tree, "README"); must_be_true(entry != NULL); @@ -114,6 +116,7 @@ BEGIN_TEST(read1, "read a tree from the repository") must_be_true(strcmp(git_tree_entry_name(entry), "README") == 0); must_pass(git_tree_entry_2object(&obj, repo, entry)); + must_be_true(obj != NULL); git_object_close(obj); git_tree_close(tree); |
