Skip to content

Commit 709b3f3

Browse files
rscharfegitster
authored andcommitted
range-diff: avoid segfault with -I
output() reuses the same struct diff_options for multiple calls of diff_flush(). Set the option no_free to instruct it to keep the ignore regexes between calls and release them explicitly at the end. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 225bc32 commit 709b3f3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

range-diff.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ static void output(struct string_list *a, struct string_list *b,
485485
else
486486
diff_setup(&opts);
487487

488+
opts.no_free = 1;
488489
if (!opts.output_format)
489490
opts.output_format = DIFF_FORMAT_PATCH;
490491
opts.flags.suppress_diff_headers = 1;
@@ -545,6 +546,8 @@ static void output(struct string_list *a, struct string_list *b,
545546
strbuf_release(&buf);
546547
strbuf_release(&dashes);
547548
strbuf_release(&indent);
549+
opts.no_free = 0;
550+
diff_free(&opts);
548551
}
549552

550553
int show_range_diff(const char *range1, const char *range2,

0 commit comments

Comments
 (0)