builtin/blame.c::prepare_lines: fix allocation size of sb->lineno
authorDavid Kastrup <dak@gnu.org>
Sat, 8 Feb 2014 09:19:26 +0000 (10:19 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 24 Feb 2014 22:32:41 +0000 (14:32 -0800)
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>
builtin/blame.c
index ead614823eae473dbba1cdb1fa5d094be2e41bbe..9566a5ea4eabcdf83af46032283fa6ede426bca0 100644 (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;