summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-10-19 13:34:07 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-10-19 13:34:07 +0900
commitd4cd2dd214c9800c8ccf45cf413acc727f4abcc2 (patch)
treee290229b139db34fc192dc04f3a25dc210a037a7 /builtin
parentMerge branch 'jt/non-blob-lazy-fetch' (diff)
parentcommit-graph: reduce initial oid allocation (diff)
downloadtgif-d4cd2dd214c9800c8ccf45cf413acc727f4abcc2.tar.xz
Merge branch 'ds/commit-graph-leakfix'
Code clean-up. * ds/commit-graph-leakfix: commit-graph: reduce initial oid allocation builtin/commit-graph.c: UNLEAK variables commit-graph: clean up leaked memory during write
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit-graph.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index 22b974f4b4..c02a3f1221 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -64,6 +64,7 @@ static int graph_verify(int argc, const char **argv)
if (!graph)
return 0;
+ UNLEAK(graph);
return verify_commit_graph(the_repository, graph);
}
@@ -89,10 +90,8 @@ static int graph_read(int argc, const char **argv)
graph_name = get_commit_graph_filename(opts.obj_dir);
graph = load_commit_graph_one(graph_name);
- if (!graph) {
- UNLEAK(graph_name);
+ if (!graph)
die("graph file %s does not exist", graph_name);
- }
FREE_AND_NULL(graph_name);
@@ -115,7 +114,7 @@ static int graph_read(int argc, const char **argv)
printf(" large_edges");
printf("\n");
- free_commit_graph(graph);
+ UNLEAK(graph);
return 0;
}
@@ -170,6 +169,8 @@ static int graph_write(int argc, const char **argv)
pack_indexes = &lines;
if (opts.stdin_commits)
commit_hex = &lines;
+
+ UNLEAK(buf);
}
write_commit_graph(opts.obj_dir,
@@ -178,7 +179,7 @@ static int graph_write(int argc, const char **argv)
opts.append,
1);
- string_list_clear(&lines, 0);
+ UNLEAK(lines);
return 0;
}