Commit ae26c4b8 by Vicent Martí

Merge pull request #1943 from libgit2/ntk/fix/leaks

Fix leaks
parents c82f7f8e 61080a95
...@@ -1210,8 +1210,11 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p ...@@ -1210,8 +1210,11 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
write_start = data_start; write_start = data_start;
/* Lock the file */ /* Lock the file */
if ((result = git_filebuf_open(&file, cfg->file_path, 0, GIT_CONFIG_FILE_MODE)) < 0) if ((result = git_filebuf_open(
return result; &file, cfg->file_path, 0, GIT_CONFIG_FILE_MODE)) < 0) {
git_buf_free(&reader->buffer);
return result;
}
skip_bom(reader); skip_bom(reader);
ldot = strrchr(key, '.'); ldot = strrchr(key, '.');
......
...@@ -1477,6 +1477,8 @@ void test_diff_workdir__with_stale_index(void) ...@@ -1477,6 +1477,8 @@ void test_diff_workdir__with_stale_index(void)
cl_git_pass(git_diff_foreach( cl_git_pass(git_diff_foreach(
diff, diff_file_cb, diff_hunk_cb, diff_line_cb, &exp)); diff, diff_file_cb, diff_hunk_cb, diff_line_cb, &exp));
git_diff_free(diff);
cl_assert_equal_i(16, exp.files); cl_assert_equal_i(16, exp.files);
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]); cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
cl_assert_equal_i(3, exp.file_status[GIT_DELTA_DELETED]); cl_assert_equal_i(3, exp.file_status[GIT_DELTA_DELETED]);
......
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