Skip to content

Commit 0aa6bce

Browse files
rscharfegitster
authored andcommitted
commit-graph: release strbufs after use
Signed-off-by: René Scharfe <[email protected]> Acked-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5b15eb3 commit 0aa6bce

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

commit-graph.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ static struct commit_graph *load_commit_graph_chain(struct repository *r, const
432432

433433
free(oids);
434434
fclose(fp);
435+
strbuf_release(&line);
435436

436437
return graph_chain;
437438
}
@@ -1179,7 +1180,7 @@ static int fill_oids_from_packs(struct write_commit_graph_context *ctx,
11791180
}
11801181

11811182
stop_progress(&ctx->progress);
1182-
strbuf_reset(&progress_title);
1183+
strbuf_release(&progress_title);
11831184
strbuf_release(&packname);
11841185

11851186
return 0;
@@ -1706,10 +1707,8 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
17061707
strbuf_addstr(&path, "/info/commit-graphs");
17071708
dir = opendir(path.buf);
17081709

1709-
if (!dir) {
1710-
strbuf_release(&path);
1711-
return;
1712-
}
1710+
if (!dir)
1711+
goto out;
17131712

17141713
strbuf_addch(&path, '/');
17151714
dirnamelen = path.len;
@@ -1738,6 +1737,9 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
17381737
if (!found)
17391738
unlink(path.buf);
17401739
}
1740+
1741+
out:
1742+
strbuf_release(&path);
17411743
}
17421744

17431745
int write_commit_graph(const char *obj_dir,

0 commit comments

Comments
 (0)