diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-10-28 14:51:13 -0700 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-10-28 19:02:36 -0700 |
commit | 3286c408eccb18c525ca123383f3ebf5097441bc (patch) | |
tree | 4422fe16ab4f7b9cf713e0209cbb74fb4115889e /tests | |
parent | da37654d04617b4dacce6e7a4796007d2854624d (diff) | |
download | libgit2-3286c408eccb18c525ca123383f3ebf5097441bc.tar.gz |
global: Properly use `git__` memory wrappers
Ensure that all memory related functions (malloc, calloc, strdup, free,
etc) are using their respective `git__` wrappers.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/t00-core.c | 8 | ||||
-rw-r--r-- | tests/t01-rawobj.c | 4 | ||||
-rw-r--r-- | tests/t04-commit.c | 6 | ||||
-rw-r--r-- | tests/t07-hashtable.c | 6 | ||||
-rw-r--r-- | tests/test_helpers.c | 2 |
5 files changed, 13 insertions, 13 deletions
diff --git a/tests/t00-core.c b/tests/t00-core.c index 703504bf8..f93444d57 100644 --- a/tests/t00-core.c +++ b/tests/t00-core.c @@ -99,8 +99,8 @@ BEGIN_TEST(vector2, "remove duplicates") must_be_true(x.length == 2); git_vector_free(&x); - free(ptrs[0]); - free(ptrs[1]); + git__free(ptrs[0]); + git__free(ptrs[1]); END_TEST @@ -112,7 +112,7 @@ BEGIN_TEST(path0, "get the dirname of a path") must_be_true(strcmp(dir, B) == 0); \ must_be_true((dir2 = git_path_dirname(A)) != NULL); \ must_be_true(strcmp(dir2, B) == 0); \ - free(dir2); \ + git__free(dir2); \ } DIRNAME_TEST(NULL, "."); @@ -141,7 +141,7 @@ BEGIN_TEST(path1, "get the base name of a path") must_be_true(strcmp(base, B) == 0); \ must_be_true((base2 = git_path_basename(A)) != NULL); \ must_be_true(strcmp(base2, B) == 0); \ - free(base2); \ + git__free(base2); \ } BASENAME_TEST(NULL, "."); diff --git a/tests/t01-rawobj.c b/tests/t01-rawobj.c index 255208532..8b05f3394 100644 --- a/tests/t01-rawobj.c +++ b/tests/t01-rawobj.c @@ -217,7 +217,7 @@ BEGIN_TEST(oid12, "compare oids (allocate + format)") out = git_oid_allocfmt(&in); must_be_true(out); must_be_true(strcmp(exp, out) == 0); - free(out); + git__free(out); END_TEST BEGIN_TEST(oid13, "compare oids (path format)") @@ -390,7 +390,7 @@ BEGIN_TEST(oid17, "stress test for the git_oid_shorten object") /* cleanup */ for (i = 0; i < MAX_OIDS; ++i) - free(oids[i]); + git__free(oids[i]); git_oid_shorten_free(os); diff --git a/tests/t04-commit.c b/tests/t04-commit.c index 3fb4d370c..303b8f7cb 100644 --- a/tests/t04-commit.c +++ b/tests/t04-commit.c @@ -162,7 +162,7 @@ BEGIN_TEST(parse1, "parse the signature line in a commit") must_be_true(strcmp(_email, person.email) == 0);\ must_be_true(_time == person.when.time);\ must_be_true(_offset == person.when.offset);\ - free(person.name); free(person.email);\ + git__free(person.name); git__free(person.email);\ } #define TEST_SIGNATURE_FAIL(_string, _header) { \ @@ -170,7 +170,7 @@ BEGIN_TEST(parse1, "parse the signature line in a commit") size_t len = strlen(_string);\ git_signature person = {NULL, NULL, {0, 0}}; \ must_fail(git_signature__parse(&person, &ptr, ptr + len, _header, '\n'));\ - free(person.name); free(person.email);\ + git__free(person.name); git__free(person.email);\ } TEST_SIGNATURE_PASS( @@ -759,7 +759,7 @@ BEGIN_TEST(root0, "create a root commit") must_pass(git_reference_set_target(head, head_old)); must_pass(git_reference_delete(branch)); must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)commit)); - free(head_old); + git__free(head_old); git_commit_close(commit); git_repository_free(repo); END_TEST diff --git a/tests/t07-hashtable.c b/tests/t07-hashtable.c index c0e852259..41d52af19 100644 --- a/tests/t07-hashtable.c +++ b/tests/t07-hashtable.c @@ -103,7 +103,7 @@ BEGIN_TEST(table1, "fill the hashtable with random entries") } git_hashtable_free(table); - free(objects); + git__free(objects); END_TEST @@ -145,7 +145,7 @@ BEGIN_TEST(table2, "make sure the table resizes automatically") } git_hashtable_free(table); - free(objects); + git__free(objects); END_TEST @@ -179,7 +179,7 @@ BEGIN_TEST(tableit0, "iterate through all the contents of the table") must_be_true(objects[i].visited); git_hashtable_free(table); - free(objects); + git__free(objects); END_TEST diff --git a/tests/test_helpers.c b/tests/test_helpers.c index cb95607e1..d1d7c9ebd 100644 --- a/tests/test_helpers.c +++ b/tests/test_helpers.c @@ -116,7 +116,7 @@ int remove_loose_object(const char *repository_folder, git_object *object) return -1; } - free(full_path); + git__free(full_path); return GIT_SUCCESS; } |