Skip to content

Commit

Permalink
Merge branch 'es/blame-commit-info-fix' into maint
Browse files Browse the repository at this point in the history
"git blame" died, trying to free an uninitialized piece of memory.

* es/blame-commit-info-fix:
  builtin/blame: destroy initialized commit_info only
  • Loading branch information
Junio C Hamano committed Mar 5, 2015
2 parents 3336757 + e600592 commit 007f7f6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions builtin/blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -2085,7 +2085,6 @@ static void find_alignment(struct scoreboard *sb, int *option)

for (e = sb->ent; e; e = e->next) {
struct origin *suspect = e->suspect;
struct commit_info ci;
int num;

if (compute_auto_abbrev)
Expand All @@ -2096,6 +2095,7 @@ static void find_alignment(struct scoreboard *sb, int *option)
if (longest_file < num)
longest_file = num;
if (!(suspect->commit->object.flags & METAINFO_SHOWN)) {
struct commit_info ci;
suspect->commit->object.flags |= METAINFO_SHOWN;
get_commit_info(suspect->commit, &ci, 1);
if (*option & OUTPUT_SHOW_EMAIL)
Expand All @@ -2104,6 +2104,7 @@ static void find_alignment(struct scoreboard *sb, int *option)
num = utf8_strwidth(ci.author.buf);
if (longest_author < num)
longest_author = num;
commit_info_destroy(&ci);
}
num = e->s_lno + e->num_lines;
if (longest_src_lines < num)
Expand All @@ -2113,8 +2114,6 @@ static void find_alignment(struct scoreboard *sb, int *option)
longest_dst_lines = num;
if (largest_score < ent_score(sb, e))
largest_score = ent_score(sb, e);

commit_info_destroy(&ci);
}
max_orig_digits = decimal_width(longest_src_lines);
max_digits = decimal_width(longest_dst_lines);
Expand Down

0 comments on commit 007f7f6

Please sign in to comment.