Skip to contentSkip to conversation

diff-tree: call free_commit_list() instead of duplicating its code

PATCH New René Scharfe 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 diff-tree: call free_commit_list() instead of duplicating its code

---
 builtin/diff-tree.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
builtin/diff-tree.c +2 -6
index be6417d..ce0e019 100644
@@ -22,14 +22,10 @@ static int stdin_diff_commit(struct commit *commit, char *line, int len)
 	if (isspace(line[40]) && !get_sha1_hex(line+41, sha1)) {
 		/* Graft the fake parents locally to the commit */
 		int pos = 41;
-		struct commit_list **pptr, *parents;
+		struct commit_list **pptr;
 
 		/* Free the real parent list */
-		for (parents = commit->parents; parents; ) {
-			struct commit_list *tmp = parents->next;
-			free(parents);
-			parents = tmp;
-		}
+		free_commit_list(commit->parents);
 		commit->parents = NULL;
 		pptr = &(commit->parents);
 		while (line[pos] && !get_sha1_hex(line + pos, sha1)) {
Signature · 1 line
2.0.0