Skip to content

Commit

Permalink
Merge branch 'ds/commit-graph-incremental'
Browse files Browse the repository at this point in the history
Leakfix.

* ds/commit-graph-incremental:
  commit-graph: release strbufs after use
  • Loading branch information
gitster committed Aug 9, 2019
2 parents c2a8c37 + 0aa6bce commit 203cf46
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions commit-graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ static struct commit_graph *load_commit_graph_chain(struct repository *r, const

free(oids);
fclose(fp);
strbuf_release(&line);

return graph_chain;
}
Expand Down Expand Up @@ -1186,7 +1187,7 @@ static int fill_oids_from_packs(struct write_commit_graph_context *ctx,
}

stop_progress(&ctx->progress);
strbuf_reset(&progress_title);
strbuf_release(&progress_title);
strbuf_release(&packname);

return 0;
Expand Down Expand Up @@ -1713,10 +1714,8 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
strbuf_addstr(&path, "/info/commit-graphs");
dir = opendir(path.buf);

if (!dir) {
strbuf_release(&path);
return;
}
if (!dir)
goto out;

strbuf_addch(&path, '/');
dirnamelen = path.len;
Expand Down Expand Up @@ -1745,6 +1744,9 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
if (!found)
unlink(path.buf);
}

out:
strbuf_release(&path);
}

int write_commit_graph(const char *obj_dir,
Expand Down

0 comments on commit 203cf46

Please sign in to comment.