Commit a7ff6e5e by lhchavez

Fix the memory leak

parent def644e4
...@@ -154,7 +154,9 @@ void test_pack_indexer__no_tmp_files(void) ...@@ -154,7 +154,9 @@ void test_pack_indexer__no_tmp_files(void)
/* Precondition: there are no temporary files. */ /* Precondition: there are no temporary files. */
cl_git_pass(git_buf_sets(&path, clar_sandbox_path())); cl_git_pass(git_buf_sets(&path, clar_sandbox_path()));
cl_git_pass(find_tmp_file_recurs(&first_tmp_file, &path)); cl_git_pass(find_tmp_file_recurs(&first_tmp_file, &path));
git_buf_free(&path);
if (git_buf_is_allocated(&first_tmp_file)) { 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_warning("Found a temporary file before running the test");
cl_skip(); cl_skip();
} }
...@@ -162,6 +164,12 @@ void test_pack_indexer__no_tmp_files(void) ...@@ -162,6 +164,12 @@ void test_pack_indexer__no_tmp_files(void)
cl_git_pass(git_indexer_new(&idx, ".", 0, NULL, NULL, NULL)); cl_git_pass(git_indexer_new(&idx, ".", 0, NULL, NULL, NULL));
git_indexer_free(idx); 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_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");
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment