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>
This commit is contained in:
René Scharfe 2019-08-07 13:15:02 +02:00 committed by Junio C Hamano
parent 5b15eb397d
commit 0aa6bce736

View File

@ -432,6 +432,7 @@ static struct commit_graph *load_commit_graph_chain(struct repository *r, const
free(oids); free(oids);
fclose(fp); fclose(fp);
strbuf_release(&line);
return graph_chain; return graph_chain;
} }
@ -1179,7 +1180,7 @@ static int fill_oids_from_packs(struct write_commit_graph_context *ctx,
} }
stop_progress(&ctx->progress); stop_progress(&ctx->progress);
strbuf_reset(&progress_title); strbuf_release(&progress_title);
strbuf_release(&packname); strbuf_release(&packname);
return 0; return 0;
@ -1706,10 +1707,8 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
strbuf_addstr(&path, "/info/commit-graphs"); strbuf_addstr(&path, "/info/commit-graphs");
dir = opendir(path.buf); dir = opendir(path.buf);
if (!dir) { if (!dir)
strbuf_release(&path); goto out;
return;
}
strbuf_addch(&path, '/'); strbuf_addch(&path, '/');
dirnamelen = path.len; dirnamelen = path.len;
@ -1738,6 +1737,9 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
if (!found) if (!found)
unlink(path.buf); unlink(path.buf);
} }
out:
strbuf_release(&path);
} }
int write_commit_graph(const char *obj_dir, int write_commit_graph(const char *obj_dir,