summaryrefslogtreecommitdiff
path: root/tests-clar/diff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-03-04 00:21:56 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2013-03-04 00:21:56 +0100
commit323bb88514347ebb7a1d760490384b305f4f4d92 (patch)
treee7529d3e16050b69af146479c66d70647290675e /tests-clar/diff
parentdce5f26f4d72b024891e70f6130e63389d9f181a (diff)
downloadlibgit2-323bb88514347ebb7a1d760490384b305f4f4d92.tar.gz
Fix a few leaks
`git_diff_get_patch()` would unconditionally load the patch object and then simply leak it if the user hadn't requested it. Short-circuit loading the object if the user doesn't want it. The rest of the plugs are simply calling the free functions of objects allocated during the tests.
Diffstat (limited to 'tests-clar/diff')
-rw-r--r--tests-clar/diff/patch.c2
-rw-r--r--tests-clar/diff/rename.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/tests-clar/diff/patch.c b/tests-clar/diff/patch.c
index 77da37db6..4d17da468 100644
--- a/tests-clar/diff/patch.c
+++ b/tests-clar/diff/patch.c
@@ -239,6 +239,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
git_diff_patch_free(patch);
git_diff_list_free(diff);
git_tree_free(head);
+ git_config_free(cfg);
}
static void check_single_patch_stats(
@@ -310,4 +311,5 @@ void test_diff_patch__line_counts_with_eofnl(void)
check_single_patch_stats(g_repo, 1, 1, 1);
git_buf_free(&content);
+ git_config_free(cfg);
}
diff --git a/tests-clar/diff/rename.c b/tests-clar/diff/rename.c
index 539512538..ae766408c 100644
--- a/tests-clar/diff/rename.c
+++ b/tests-clar/diff/rename.c
@@ -274,6 +274,7 @@ void test_diff_rename__not_exact_match(void)
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_ADDED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_DELETED]);
+ git_diff_list_free(diff);
/* git diff -M -C \
* 1c068dee5790ef1580cfc4cd670915b48d790084 \