Commit d7c7cab8 by Vicent Marti

Fix memory leak in t0401

Commit object must be internally free'd after each parse attempt, even
it fails.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
parent 111e3622
...@@ -252,6 +252,7 @@ BEGIN_TEST(parse_buffer_test) ...@@ -252,6 +252,7 @@ BEGIN_TEST(parse_buffer_test)
for (i = 0; i < working_commit_count; ++i) { for (i = 0; i < working_commit_count; ++i) {
git_commit *commit; git_commit *commit;
commit = git__malloc(sizeof(git_commit)); commit = git__malloc(sizeof(git_commit));
memset(commit, 0x0, sizeof(git_commit)); memset(commit, 0x0, sizeof(git_commit));
commit->object.repo = repo; commit->object.repo = repo;
...@@ -263,6 +264,9 @@ BEGIN_TEST(parse_buffer_test) ...@@ -263,6 +264,9 @@ BEGIN_TEST(parse_buffer_test)
0x0) 0x0)
); );
git_commit__free(commit);
commit = git__malloc(sizeof(git_commit));
memset(commit, 0x0, sizeof(git_commit)); memset(commit, 0x0, sizeof(git_commit));
commit->object.repo = repo; commit->object.repo = repo;
......
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