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>
David Kastrup committed
Feb 8, 2014 at 10:19 UTC
62cf3ca95a7b34dcbf22d9ba4b2ea56f9fb739c9
1 file changed
+2
-2
builtin/blame.c
+2
-2
@@ -1763,7 +1763,7 @@ static int prepare_lines(struct scoreboard *sb)
1763
while (len--) {
1764
if (bol) {
1765
sb->lineno = xrealloc(sb->lineno,
1766
- sizeof(int *) * (num + 1));
1766
+ sizeof(int) * (num + 1));
1767
sb->lineno[num] = buf - sb->final_buf;
1768
bol = 0;
1769
}
@@ -1773,7 +1773,7 @@ static int prepare_lines(struct scoreboard *sb)
1773
}
1774
}
1775
sb->lineno = xrealloc(sb->lineno,
1776
- sizeof(int *) * (num + incomplete + 1));
1776
+ sizeof(int) * (num + incomplete + 1));
1777
sb->lineno[num + incomplete] = buf - sb->final_buf;
1778
sb->num_lines = num + incomplete;
1779
return sb->num_lines;