commit-graph: release strbufs after use

Signed-off-by: René Scharfe <l.s.r@web.de> Acked-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Aug 7, 2019 at 13:15 UTC 0aa6bce7365c97ab1e26791ee03b3a83f7e784dd
1 file changed +7 -5
commit-graph.c
+7 -5
@@ -432,6 +432,7 @@ static struct commit_graph *load_commit_graph_chain(struct repository *r, const
432
433 free(oids);
434 fclose(fp);
435 + strbuf_release(&line);
436
437 return graph_chain;
438 }
@@ -1179,7 +1180,7 @@ static int fill_oids_from_packs(struct write_commit_graph_context *ctx,
1180 }
1181
1182 stop_progress(&ctx->progress);
1182 - strbuf_reset(&progress_title);
1183 + strbuf_release(&progress_title);
1184 strbuf_release(&packname);
1185
1186 return 0;
@@ -1706,10 +1707,8 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
1707 strbuf_addstr(&path, "/info/commit-graphs");
1708 dir = opendir(path.buf);
1709
1709 - if (!dir) {
1710 - strbuf_release(&path);
1711 - return;
1712 - }
1710 + if (!dir)
1711 + goto out;
1712
1713 strbuf_addch(&path, '/');
1714 dirnamelen = path.len;
@@ -1738,6 +1737,9 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
1737 if (!found)
1738 unlink(path.buf);
1739 }
1740 +
1741 +out:
1742 + strbuf_release(&path);
1743 }
1744
1745 int write_commit_graph(const char *obj_dir,