Skip to content

Commit

Permalink
builtin/mktree.c: use ALLOC_GROW() in append_to_tree()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dmitry S. Dolzhenko authored and Junio C Hamano committed Mar 3, 2014
1 parent 3a7fa03 commit 66d9f38
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions builtin/mktree.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ static void append_to_tree(unsigned mode, unsigned char *sha1, char *path)
if (strchr(path, '/'))
die("path %s contains slash", path);

if (alloc <= used) {
alloc = alloc_nr(used);
entries = xrealloc(entries, sizeof(*entries) * alloc);
}
ALLOC_GROW(entries, used + 1, alloc);
ent = entries[used++] = xmalloc(sizeof(**entries) + len + 1);
ent->mode = mode;
ent->len = len;
Expand Down

0 comments on commit 66d9f38

Please sign in to comment.