diff options
-rw-r--r-- | src/refdb_fs.c | 5 | ||||
-rw-r--r-- | src/reset.c | 1 | ||||
-rw-r--r-- | tests/clone/empty.c | 2 | ||||
-rw-r--r-- | tests/odb/backend/nobackend.c | 5 | ||||
-rw-r--r-- | tests/reset/hard.c | 4 | ||||
-rw-r--r-- | tests/reset/mixed.c | 6 |
6 files changed, 22 insertions, 1 deletions
diff --git a/src/refdb_fs.c b/src/refdb_fs.c index 3219b0519..8a26bec0b 100644 --- a/src/refdb_fs.c +++ b/src/refdb_fs.c @@ -1343,7 +1343,10 @@ static int refdb_reflog_fs__ensure_log(git_refdb_backend *_backend, const char * if ((error = retrieve_reflog_path(&path, repo, name)) < 0) return error; - return create_new_reflog_file(git_buf_cstr(&path)); + error = create_new_reflog_file(git_buf_cstr(&path)); + git_buf_free(&path); + + return error; } static int has_reflog(git_repository *repo, const char *name) diff --git a/src/reset.c b/src/reset.c index 07fd08863..2a78d312c 100644 --- a/src/reset.c +++ b/src/reset.c @@ -167,6 +167,7 @@ cleanup: git_object_free(commit); git_index_free(index); git_tree_free(tree); + git_buf_free(&log_message_buf); return error; } diff --git a/tests/clone/empty.c b/tests/clone/empty.c index 78aef7dae..8f6071096 100644 --- a/tests/clone/empty.c +++ b/tests/clone/empty.c @@ -53,11 +53,13 @@ void test_clone_empty__can_clone_an_empty_local_repo_barely(void) cl_git_pass(git_branch_upstream_name(&buf, g_repo_cloned, local_name)); cl_assert_equal_s(expected_tracked_branch_name, buf.ptr); + git_buf_free(&buf); /* ...and the name of the remote... */ cl_git_pass(git_branch_remote_name(&buf, g_repo_cloned, expected_tracked_branch_name)); cl_assert_equal_s(expected_remote_name, buf.ptr); + git_buf_free(&buf); /* ...even when the remote HEAD is unborn as well */ cl_assert_equal_i(GIT_ENOTFOUND, git_reference_lookup(&ref, g_repo_cloned, diff --git a/tests/odb/backend/nobackend.c b/tests/odb/backend/nobackend.c index 7ed5acced..783641e8f 100644 --- a/tests/odb/backend/nobackend.c +++ b/tests/odb/backend/nobackend.c @@ -18,6 +18,11 @@ void test_odb_backend_nobackend__initialize(void) git_repository_set_config(_repo, config); git_repository_set_odb(_repo, odb); git_repository_set_refdb(_repo, refdb); + + /* The set increases the refcount and we don't want them anymore */ + git_config_free(config); + git_odb_free(odb); + git_refdb_free(refdb); } void test_odb_backend_nobackend__cleanup(void) diff --git a/tests/reset/hard.c b/tests/reset/hard.c index d4c7db45f..36120ee63 100644 --- a/tests/reset/hard.c +++ b/tests/reset/hard.c @@ -212,12 +212,16 @@ void test_reset_hard__reflog_is_correct(void) reflog_check(repo, "HEAD", 3, "emeric.fermas@gmail.com", exp_msg); reflog_check(repo, "refs/heads/master", 3, "emeric.fermas@gmail.com", exp_msg); + git_object_free(target); + /* Moved branch, expect default message */ cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}")); cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL)); reflog_check(repo, "HEAD", 3, "emeric.fermas@gmail.com", exp_msg); reflog_check(repo, "refs/heads/master", 4, NULL, "reset: moving"); + git_object_free(target); + /* Moved branch, expect custom message */ cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}")); cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, "message1")); diff --git a/tests/reset/mixed.c b/tests/reset/mixed.c index 25272a75c..5d8ff63b4 100644 --- a/tests/reset/mixed.c +++ b/tests/reset/mixed.c @@ -61,12 +61,18 @@ void test_reset_mixed__reflog_is_correct(void) reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg); reflog_check(repo, "refs/heads/master", 9, "yoram.harmelin@gmail.com", exp_msg); + git_object_free(target); + target = NULL; + /* Moved branch, expect default message */ cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}")); cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL)); reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg); reflog_check(repo, "refs/heads/master", 10, NULL, "reset: moving"); + git_object_free(target); + target = NULL; + /* Moved branch, expect custom message */ cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}")); cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, "message1")); |