Skip to content

Commit f95bafb

Browse files
committed
Merge branch 'ps/commit-graph-write-leakfix'
Leakfix. * ps/commit-graph-write-leakfix: commit-graph: fix memory leak when not writing graph
2 parents b982aa9 + 4efa930 commit f95bafb

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

commit-graph.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,19 +2619,16 @@ int write_commit_graph(struct object_directory *odb,
26192619
oid_array_clear(&ctx->oids);
26202620
clear_topo_level_slab(&topo_levels);
26212621

2622-
if (ctx->commit_graph_filenames_after) {
2623-
for (i = 0; i < ctx->num_commit_graphs_after; i++) {
2624-
free(ctx->commit_graph_filenames_after[i]);
2625-
free(ctx->commit_graph_hash_after[i]);
2626-
}
2627-
2628-
for (i = 0; i < ctx->num_commit_graphs_before; i++)
2629-
free(ctx->commit_graph_filenames_before[i]);
2622+
for (i = 0; i < ctx->num_commit_graphs_before; i++)
2623+
free(ctx->commit_graph_filenames_before[i]);
2624+
free(ctx->commit_graph_filenames_before);
26302625

2631-
free(ctx->commit_graph_filenames_after);
2632-
free(ctx->commit_graph_filenames_before);
2633-
free(ctx->commit_graph_hash_after);
2626+
for (i = 0; i < ctx->num_commit_graphs_after; i++) {
2627+
free(ctx->commit_graph_filenames_after[i]);
2628+
free(ctx->commit_graph_hash_after[i]);
26342629
}
2630+
free(ctx->commit_graph_filenames_after);
2631+
free(ctx->commit_graph_hash_after);
26352632

26362633
free(ctx);
26372634

0 commit comments

Comments
 (0)