diff options
author | lhchavez <lhchavez@lhchavez.com> | 2017-01-03 18:24:51 -0800 |
---|---|---|
committer | lhchavez <lhchavez@lhchavez.com> | 2017-01-03 18:24:51 -0800 |
commit | a7ff6e5e5e2715ecccdb217f2018dc2567e1eebd (patch) | |
tree | c4c0aaba3823730a3c306cc29ef2acbdc099881a /tests/pack | |
parent | def644e48a3cd4afd0cee975d3214eeeb3671c99 (diff) | |
download | libgit2-a7ff6e5e5e2715ecccdb217f2018dc2567e1eebd.tar.gz |
Fix the memory leak
Diffstat (limited to 'tests/pack')
-rw-r--r-- | tests/pack/indexer.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/pack/indexer.c b/tests/pack/indexer.c index 15a9017f1..2c9724605 100644 --- a/tests/pack/indexer.c +++ b/tests/pack/indexer.c @@ -154,7 +154,9 @@ void test_pack_indexer__no_tmp_files(void) /* Precondition: there are no temporary files. */ cl_git_pass(git_buf_sets(&path, clar_sandbox_path())); cl_git_pass(find_tmp_file_recurs(&first_tmp_file, &path)); + git_buf_free(&path); if (git_buf_is_allocated(&first_tmp_file)) { + git_buf_free(&first_tmp_file); cl_warning("Found a temporary file before running the test"); cl_skip(); } @@ -162,6 +164,12 @@ void test_pack_indexer__no_tmp_files(void) cl_git_pass(git_indexer_new(&idx, ".", 0, NULL, NULL, NULL)); git_indexer_free(idx); + cl_git_pass(git_buf_sets(&path, clar_sandbox_path())); cl_git_pass(find_tmp_file_recurs(&first_tmp_file, &path)); - cl_check(!git_buf_is_allocated(&first_tmp_file)); + git_buf_free(&path); + if (git_buf_is_allocated(&first_tmp_file)) { + cl_warning(git_buf_cstr(&first_tmp_file)); + git_buf_free(&first_tmp_file); + cl_fail("Found a temporary file"); + } } |