Skip to content

Commit c4a7b00

Browse files
modocachegitster
authored andcommitted
commit.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size. reduce_heads() passes the arguments in reverse order, passing the size of a commit*, followed by the number of commit* to be allocated. Rearrange them so they are in the correct order. Signed-off-by: Brian Gesiak <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3806945 commit c4a7b00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ struct commit_list *reduce_heads(struct commit_list *heads)
10311031
p->item->object.flags |= STALE;
10321032
num_head++;
10331033
}
1034-
array = xcalloc(sizeof(*array), num_head);
1034+
array = xcalloc(num_head, sizeof(*array));
10351035
for (p = heads, i = 0; p; p = p->next) {
10361036
if (p->item->object.flags & STALE) {
10371037
array[i++] = p->item;

0 commit comments

Comments
 (0)