diff options
author | Sascha Cunz <Sascha@BabbelBox.org> | 2012-12-19 08:04:31 +0100 |
---|---|---|
committer | Sascha Cunz <Sascha@BabbelBox.org> | 2012-12-19 08:04:31 +0100 |
commit | d5cf4665a9b4fa3b81f8af1fde2d234106176851 (patch) | |
tree | 29ed38440a19bc5c35b63112d6a2e2f6f0593133 /tests-clar/diff/index.c | |
parent | 96a289f5f3d2ceeb84ac50216c44107583b48b8d (diff) | |
download | libgit2-d5cf4665a9b4fa3b81f8af1fde2d234106176851.tar.gz |
Fix some leaks and (possibly) dangling pointers in tests
Also adds some asserts.
Diffstat (limited to 'tests-clar/diff/index.c')
-rw-r--r-- | tests-clar/diff/index.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests-clar/diff/index.c b/tests-clar/diff/index.c index 41941ee28..e1c617dae 100644 --- a/tests-clar/diff/index.c +++ b/tests-clar/diff/index.c @@ -146,18 +146,22 @@ void test_diff_index__checks_options_version(void) const char *a_commit = "26a125ee1bf"; git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit); git_diff_options opts = GIT_DIFF_OPTIONS_INIT; - git_diff_list *diff; + git_diff_list *diff = NULL; const git_error *err; opts.version = 0; cl_git_fail(git_diff_tree_to_index(&diff, g_repo, a, NULL, &opts)); err = giterr_last(); cl_assert_equal_i(GITERR_INVALID, err->klass); + cl_assert_equal_p(diff, NULL); giterr_clear(); opts.version = 1024; cl_git_fail(git_diff_tree_to_index(&diff, g_repo, a, NULL, &opts)); err = giterr_last(); cl_assert_equal_i(GITERR_INVALID, err->klass); + cl_assert_equal_p(diff, NULL); + + git_tree_free(a); } |