diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-01-26 08:54:45 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-01-26 08:54:45 -0800 |
| commit | f95bafbaed2d9f9c891e04c3680c1aa0da30629e (patch) | |
| tree | bbe38a18d985c10bc93fbb228931f6d2de004861 /commit-graph.c | |
| parent | Merge branch 'al/unit-test-ctype' (diff) | |
| parent | commit-graph: fix memory leak when not writing graph (diff) | |
| download | git-f95bafbaed2d9f9c891e04c3680c1aa0da30629e.tar.gz git-f95bafbaed2d9f9c891e04c3680c1aa0da30629e.zip | |
Merge branch 'ps/commit-graph-write-leakfix'
Leakfix.
* ps/commit-graph-write-leakfix:
commit-graph: fix memory leak when not writing graph
Diffstat (limited to 'commit-graph.c')
| -rw-r--r-- | commit-graph.c | 19 |
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); |
