Merge branch 'jk/commit-graph-leak-fixes'
Leakfix. * jk/commit-graph-leak-fixes: commit-graph: clear oidset after finishing write commit-graph: free write-context base_graph_name during cleanup commit-graph: free write-context entries before overwriting commit-graph: free graph struct that was not added to chain commit-graph: delay base_graph assignment in add_graph_to_chain() commit-graph: free all elements of graph chain commit-graph: move slab-clearing to close_commit_graph() merge: free result of repo_get_merge_bases() commit-reach: free temporary list in get_octopus_merge_bases() t6700: mark test as leak-freemaint
commit
a45eddec40
|
@ -328,6 +328,7 @@ cleanup:
|
||||||
FREE_AND_NULL(options);
|
FREE_AND_NULL(options);
|
||||||
string_list_clear(&pack_indexes, 0);
|
string_list_clear(&pack_indexes, 0);
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
|
oidset_clear(&commits);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1632,6 +1632,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
for (j = remoteheads; j; j = j->next) {
|
for (j = remoteheads; j; j = j->next) {
|
||||||
struct commit_list *common_one;
|
struct commit_list *common_one;
|
||||||
|
struct commit *common_item;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Here we *have* to calculate the individual
|
* Here we *have* to calculate the individual
|
||||||
|
@ -1641,7 +1642,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||||
common_one = repo_get_merge_bases(the_repository,
|
common_one = repo_get_merge_bases(the_repository,
|
||||||
head_commit,
|
head_commit,
|
||||||
j->item);
|
j->item);
|
||||||
if (!oideq(&common_one->item->object.oid, &j->item->object.oid)) {
|
common_item = common_one->item;
|
||||||
|
free_commit_list(common_one);
|
||||||
|
if (!oideq(&common_item->object.oid, &j->item->object.oid)) {
|
||||||
up_to_date = 0;
|
up_to_date = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -523,8 +523,6 @@ static int add_graph_to_chain(struct commit_graph *g,
|
||||||
cur_g = cur_g->base_graph;
|
cur_g = cur_g->base_graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
g->base_graph = chain;
|
|
||||||
|
|
||||||
if (chain) {
|
if (chain) {
|
||||||
if (unsigned_add_overflows(chain->num_commits,
|
if (unsigned_add_overflows(chain->num_commits,
|
||||||
chain->num_commits_in_base)) {
|
chain->num_commits_in_base)) {
|
||||||
|
@ -535,6 +533,8 @@ static int add_graph_to_chain(struct commit_graph *g,
|
||||||
g->num_commits_in_base = chain->num_commits + chain->num_commits_in_base;
|
g->num_commits_in_base = chain->num_commits + chain->num_commits_in_base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g->base_graph = chain;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,6 +601,8 @@ struct commit_graph *load_commit_graph_chain_fd_st(struct repository *r,
|
||||||
if (add_graph_to_chain(g, graph_chain, oids, i)) {
|
if (add_graph_to_chain(g, graph_chain, oids, i)) {
|
||||||
graph_chain = g;
|
graph_chain = g;
|
||||||
valid = 1;
|
valid = 1;
|
||||||
|
} else {
|
||||||
|
free_commit_graph(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -752,19 +754,10 @@ struct bloom_filter_settings *get_bloom_filter_settings(struct repository *r)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void close_commit_graph_one(struct commit_graph *g)
|
|
||||||
{
|
|
||||||
if (!g)
|
|
||||||
return;
|
|
||||||
|
|
||||||
clear_commit_graph_data_slab(&commit_graph_data_slab);
|
|
||||||
close_commit_graph_one(g->base_graph);
|
|
||||||
free_commit_graph(g);
|
|
||||||
}
|
|
||||||
|
|
||||||
void close_commit_graph(struct raw_object_store *o)
|
void close_commit_graph(struct raw_object_store *o)
|
||||||
{
|
{
|
||||||
close_commit_graph_one(o->commit_graph);
|
clear_commit_graph_data_slab(&commit_graph_data_slab);
|
||||||
|
free_commit_graph(o->commit_graph);
|
||||||
o->commit_graph = NULL;
|
o->commit_graph = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2101,9 +2094,11 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
|
||||||
free(graph_name);
|
free(graph_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(ctx->commit_graph_hash_after[ctx->num_commit_graphs_after - 1]);
|
||||||
ctx->commit_graph_hash_after[ctx->num_commit_graphs_after - 1] = xstrdup(hash_to_hex(file_hash));
|
ctx->commit_graph_hash_after[ctx->num_commit_graphs_after - 1] = xstrdup(hash_to_hex(file_hash));
|
||||||
final_graph_name = get_split_graph_filename(ctx->odb,
|
final_graph_name = get_split_graph_filename(ctx->odb,
|
||||||
ctx->commit_graph_hash_after[ctx->num_commit_graphs_after - 1]);
|
ctx->commit_graph_hash_after[ctx->num_commit_graphs_after - 1]);
|
||||||
|
free(ctx->commit_graph_filenames_after[ctx->num_commit_graphs_after - 1]);
|
||||||
ctx->commit_graph_filenames_after[ctx->num_commit_graphs_after - 1] = final_graph_name;
|
ctx->commit_graph_filenames_after[ctx->num_commit_graphs_after - 1] = final_graph_name;
|
||||||
|
|
||||||
result = rename(ctx->graph_name, final_graph_name);
|
result = rename(ctx->graph_name, final_graph_name);
|
||||||
|
@ -2552,6 +2547,7 @@ int write_commit_graph(struct object_directory *odb,
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
free(ctx->graph_name);
|
free(ctx->graph_name);
|
||||||
|
free(ctx->base_graph_name);
|
||||||
free(ctx->commits.list);
|
free(ctx->commits.list);
|
||||||
oid_array_clear(&ctx->oids);
|
oid_array_clear(&ctx->oids);
|
||||||
clear_topo_level_slab(&topo_levels);
|
clear_topo_level_slab(&topo_levels);
|
||||||
|
@ -2782,15 +2778,17 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)
|
||||||
|
|
||||||
void free_commit_graph(struct commit_graph *g)
|
void free_commit_graph(struct commit_graph *g)
|
||||||
{
|
{
|
||||||
if (!g)
|
while (g) {
|
||||||
return;
|
struct commit_graph *next = g->base_graph;
|
||||||
if (g->data) {
|
|
||||||
munmap((void *)g->data, g->data_len);
|
if (g->data)
|
||||||
g->data = NULL;
|
munmap((void *)g->data, g->data_len);
|
||||||
|
free(g->filename);
|
||||||
|
free(g->bloom_filter_settings);
|
||||||
|
free(g);
|
||||||
|
|
||||||
|
g = next;
|
||||||
}
|
}
|
||||||
free(g->filename);
|
|
||||||
free(g->bloom_filter_settings);
|
|
||||||
free(g);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void disable_commit_graph(struct repository *r)
|
void disable_commit_graph(struct repository *r)
|
||||||
|
|
|
@ -173,6 +173,7 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in)
|
||||||
for (k = bases; k; k = k->next)
|
for (k = bases; k; k = k->next)
|
||||||
end = k;
|
end = k;
|
||||||
}
|
}
|
||||||
|
free_commit_list(ret);
|
||||||
ret = new_commits;
|
ret = new_commits;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='git log --graph of skewed left octopus merge.'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-log-graph.sh
|
. "$TEST_DIRECTORY"/lib-log-graph.sh
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='git log --graph of skewed merges'
|
test_description='git log --graph of skewed merges'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-log-graph.sh
|
. "$TEST_DIRECTORY"/lib-log-graph.sh
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='split commit graph'
|
test_description='split commit graph'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
GIT_TEST_COMMIT_GRAPH=0
|
GIT_TEST_COMMIT_GRAPH=0
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='commit graph with 64-bit timestamps'
|
test_description='commit graph with 64-bit timestamps'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
if ! test_have_prereq TIME_IS_64BIT || ! test_have_prereq TIME_T_IS_64BIT
|
if ! test_have_prereq TIME_IS_64BIT || ! test_have_prereq TIME_T_IS_64BIT
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='pull options'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='ancestor culling and limiting by parent number'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
check_revlist () {
|
check_revlist () {
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='recursive merge corner cases involving criss-cross merges'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-merge.sh
|
. "$TEST_DIRECTORY"/lib-merge.sh
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='"git merge" top-level frontend'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
t3033_reset () {
|
t3033_reset () {
|
||||||
|
|
|
@ -8,6 +8,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
|
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
|
||||||
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
|
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-merge.sh
|
. "$TEST_DIRECTORY"/lib-merge.sh
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='handling of deep trees in various commands'
|
test_description='handling of deep trees in various commands'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# We'll test against two depths here: a small one that will let us check the
|
# We'll test against two depths here: a small one that will let us check the
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='git merge
|
||||||
|
|
||||||
Testing octopus merge with more than 25 refs.'
|
Testing octopus merge with more than 25 refs.'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='git merge
|
||||||
|
|
||||||
Testing octopus merge when reducing parents to independent branches.'
|
Testing octopus merge when reducing parents to independent branches.'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# 0 - 1
|
# 0 - 1
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description="Test that merge state is as expected after failed merge"
|
||||||
|
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'Ensure we restore original state if no merge strategy handles it' '
|
test_expect_success 'Ensure we restore original state if no merge strategy handles it' '
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='test auto-generated merge messages'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
check_oneline() {
|
check_oneline() {
|
||||||
|
|
Loading…
Reference in New Issue