Skip to content

Commit 62cf3ca

Browse files
dakhubgitgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0a88f08 commit 62cf3ca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

builtin/blame.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,7 +1763,7 @@ static int prepare_lines(struct scoreboard *sb)
17631763
while (len--) {
17641764
if (bol) {
17651765
sb->lineno = xrealloc(sb->lineno,
1766-
sizeof(int *) * (num + 1));
1766+
sizeof(int) * (num + 1));
17671767
sb->lineno[num] = buf - sb->final_buf;
17681768
bol = 0;
17691769
}
@@ -1773,7 +1773,7 @@ static int prepare_lines(struct scoreboard *sb)
17731773
}
17741774
}
17751775
sb->lineno = xrealloc(sb->lineno,
1776-
sizeof(int *) * (num + incomplete + 1));
1776+
sizeof(int) * (num + incomplete + 1));
17771777
sb->lineno[num + incomplete] = buf - sb->final_buf;
17781778
sb->num_lines = num + incomplete;
17791779
return sb->num_lines;

0 commit comments

Comments
 (0)