Skip to content

Commit 4602f1a

Browse files
rscharfegitster
authored andcommitted
diff-tree: call free_commit_list() instead of duplicating its code
Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6f92e5f commit 4602f1a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

builtin/diff-tree.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,10 @@ static int stdin_diff_commit(struct commit *commit, char *line, int len)
2222
if (isspace(line[40]) && !get_sha1_hex(line+41, sha1)) {
2323
/* Graft the fake parents locally to the commit */
2424
int pos = 41;
25-
struct commit_list **pptr, *parents;
25+
struct commit_list **pptr;
2626

2727
/* Free the real parent list */
28-
for (parents = commit->parents; parents; ) {
29-
struct commit_list *tmp = parents->next;
30-
free(parents);
31-
parents = tmp;
32-
}
28+
free_commit_list(commit->parents);
3329
commit->parents = NULL;
3430
pptr = &(commit->parents);
3531
while (line[pos] && !get_sha1_hex(line + pos, sha1)) {

0 commit comments

Comments
 (0)