builtin/blame.c::prepare_lines: fix allocation size of sb->lineno

If we are calling xrealloc on every single line, the least we can do
is get the right allocation size.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
David Kastrup 2014-02-08 10:19:26 +01:00 committed by Junio C Hamano
parent 0a88f08e28
commit 62cf3ca95a

View File

@ -1763,7 +1763,7 @@ static int prepare_lines(struct scoreboard *sb)
while (len--) {
if (bol) {
sb->lineno = xrealloc(sb->lineno,
sizeof(int *) * (num + 1));
sizeof(int) * (num + 1));
sb->lineno[num] = buf - sb->final_buf;
bol = 0;
}
@ -1773,7 +1773,7 @@ static int prepare_lines(struct scoreboard *sb)
}
}
sb->lineno = xrealloc(sb->lineno,
sizeof(int *) * (num + incomplete + 1));
sizeof(int) * (num + incomplete + 1));
sb->lineno[num + incomplete] = buf - sb->final_buf;
sb->num_lines = num + incomplete;
return sb->num_lines;