Commit 61080a95 by nulltoken

Fix leaks

parent b7fbfbb2
......@@ -1210,8 +1210,11 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
write_start = data_start;
/* Lock the file */
if ((result = git_filebuf_open(&file, cfg->file_path, 0, GIT_CONFIG_FILE_MODE)) < 0)
return result;
if ((result = git_filebuf_open(
&file, cfg->file_path, 0, GIT_CONFIG_FILE_MODE)) < 0) {
git_buf_free(&reader->buffer);
return result;
}
skip_bom(reader);
ldot = strrchr(key, '.');
......
......@@ -1477,6 +1477,8 @@ void test_diff_workdir__with_stale_index(void)
cl_git_pass(git_diff_foreach(
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(0, exp.file_status[GIT_DELTA_ADDED]);
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