Skip to content

Commit 66d9f38

Browse files
Dmitry S. Dolzhenkogitster
authored andcommitted
builtin/mktree.c: use ALLOC_GROW() in append_to_tree()
Helped-by: He Sun <sunheehnus@gmail.com> Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 3a7fa03 commit 66d9f38

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

builtin/mktree.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ static void append_to_tree(unsigned mode, unsigned char *sha1, char *path)
2323
if (strchr(path, '/'))
2424
die("path %s contains slash", path);
2525

26-
if (alloc <= used) {
27-
alloc = alloc_nr(used);
28-
entries = xrealloc(entries, sizeof(*entries) * alloc);
29-
}
26+
ALLOC_GROW(entries, used + 1, alloc);
3027
ent = entries[used++] = xmalloc(sizeof(**entries) + len + 1);
3128
ent->mode = mode;
3229
ent->len = len;

0 commit comments

Comments
 (0)