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

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-01-24 00:40:37 +0300
committerJunio C Hamano <gitster@pobox.com>2024-01-24 00:40:37 +0300
commit8b6b11d7eb90306db0e565a48aba14b5c086cf79 (patch)
tree6170a8a720ae77c2be8d7e11c84241fff13679c4
parentb6a27ab9b1318ed4533e5aba36f4d4afe3baded7 (diff)
parent4efa9308eabba5b474f7ff5b43a8a7b767b6de79 (diff)
Merge branch 'ps/commit-graph-write-leakfix' into jch
Leakfix. * ps/commit-graph-write-leakfix: commit-graph: fix memory leak when not writing graph
-rw-r--r--commit-graph.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/commit-graph.c b/commit-graph.c
index f86c5e9f94..45417d7412 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -2619,19 +2619,16 @@ cleanup:
oid_array_clear(&ctx->oids);
clear_topo_level_slab(&topo_levels);
- if (ctx->commit_graph_filenames_after) {
- for (i = 0; i < ctx->num_commit_graphs_after; i++) {
- free(ctx->commit_graph_filenames_after[i]);
- free(ctx->commit_graph_hash_after[i]);
- }
-
- for (i = 0; i < ctx->num_commit_graphs_before; i++)
- free(ctx->commit_graph_filenames_before[i]);
+ for (i = 0; i < ctx->num_commit_graphs_before; i++)
+ free(ctx->commit_graph_filenames_before[i]);
+ free(ctx->commit_graph_filenames_before);
- free(ctx->commit_graph_filenames_after);
- free(ctx->commit_graph_filenames_before);
- free(ctx->commit_graph_hash_after);
+ for (i = 0; i < ctx->num_commit_graphs_after; i++) {
+ free(ctx->commit_graph_filenames_after[i]);
+ free(ctx->commit_graph_hash_after[i]);
}
+ free(ctx->commit_graph_filenames_after);
+ free(ctx->commit_graph_hash_after);
free(ctx);