Fixing memory leaks indicated by valgrind This clears up the memory leaks that valgrind seems to find on my machine.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/src/path.c b/src/path.c
index ceae2ab..d2c292b 100644
--- a/src/path.c
+++ b/src/path.c
@@ -624,5 +624,7 @@ int git_path_dirload_with_stat(
}
}
+ git_buf_free(&full);
+
return error;
}
diff --git a/tests-clar/config/multivar.c b/tests-clar/config/multivar.c
index a8451ac..9a411f0 100644
--- a/tests-clar/config/multivar.c
+++ b/tests-clar/config/multivar.c
@@ -123,6 +123,8 @@ void test_config_multivar__replace(void)
n = 0;
cl_git_pass(git_config_get_multivar(cfg, _name, NULL, cb, &n));
cl_assert(n == 2);
+
+ git_config_free(cfg);
}
void test_config_multivar__replace_multiple(void)
@@ -145,4 +147,5 @@ void test_config_multivar__replace_multiple(void)
cl_git_pass(git_config_get_multivar(cfg, _name, "otherplace", cb, &n));
cl_assert(n == 2);
+ git_config_free(cfg);
}
diff --git a/tests-clar/diff/workdir.c b/tests-clar/diff/workdir.c
index 28cfa23..9fefdbb 100644
--- a/tests-clar/diff/workdir.c
+++ b/tests-clar/diff/workdir.c
@@ -158,6 +158,8 @@ void test_diff_workdir__to_tree(void)
cl_assert(exp.line_adds == 12);
cl_assert(exp.line_dels == 4);
+ git_diff_list_free(diff);
+
git_tree_free(a);
git_tree_free(b);
}