Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-06-26 19:49:39 +0300
committerCarlos Martín Nieto <cmn@dwim.me>2015-06-26 19:49:39 +0300
commitafd8a94ee754ff1f1aae20ff9174f1e3c8b9c7fe (patch)
tree5c1eee7ad868b48284073c101d4a1000cd49c4cb /tests/checkout
parent9568660f626e314651d550ed8a06ac17e750a02d (diff)
checkout: plug a few leaks
Diffstat (limited to 'tests/checkout')
-rw-r--r--tests/checkout/crlf.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/checkout/crlf.c b/tests/checkout/crlf.c
index 2cf3af364..8e77d0845 100644
--- a/tests/checkout/crlf.c
+++ b/tests/checkout/crlf.c
@@ -47,15 +47,19 @@ static int compare_file(void *payload, git_buf *actual_path)
git_buf expected_contents = GIT_BUF_INIT;
struct compare_data *cd = payload;
bool failed = true;
+ int cmp_git, cmp_gitattributes;
+ char *basename;
- if (strcmp(git_path_basename(actual_path->ptr), ".git") == 0 ||
- strcmp(git_path_basename(actual_path->ptr), ".gitattributes") == 0) {
+ basename = git_path_basename(actual_path->ptr);
+ cmp_git = strcmp(basename, ".git");
+ cmp_gitattributes = strcmp(basename, ".gitattributes");
+
+ if (cmp_git == 0 || cmp_gitattributes == 0) {
failed = false;
goto done;
}
- cl_git_pass(git_buf_joinpath(&expected_path, cd->dirname,
- git_path_basename(actual_path->ptr)));
+ cl_git_pass(git_buf_joinpath(&expected_path, cd->dirname, basename));
if (!git_path_isfile(expected_path.ptr) ||
!git_path_isfile(actual_path->ptr))
@@ -83,6 +87,7 @@ done:
git_buf_free(&details);
}
+ git__free(basename);
git_buf_free(&expected_contents);
git_buf_free(&actual_contents);
git_buf_free(&expected_path);
@@ -151,7 +156,12 @@ static void empty_workdir(const char *name)
git_path_dirload(&contents, name, 0, 0);
git_vector_foreach(&contents, i, fn) {
- if (strncasecmp(git_path_basename(fn), ".git", 4) == 0)
+ char *basename = git_path_basename(fn);
+ int cmp = strncasecmp(basename, ".git", 4);
+
+ git__free(basename);
+
+ if (cmp == 0)
continue;
p_unlink(fn);
}