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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
							parent
							
								
									225bc32a98
								
							
						
					
					
						commit
						709b3f32d3
					
				| 
						 | 
				
			
			@ -485,6 +485,7 @@ static void output(struct string_list *a, struct string_list *b,
 | 
			
		|||
	else
 | 
			
		||||
		diff_setup(&opts);
 | 
			
		||||
 | 
			
		||||
	opts.no_free = 1;
 | 
			
		||||
	if (!opts.output_format)
 | 
			
		||||
		opts.output_format = DIFF_FORMAT_PATCH;
 | 
			
		||||
	opts.flags.suppress_diff_headers = 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -545,6 +546,8 @@ static void output(struct string_list *a, struct string_list *b,
 | 
			
		|||
	strbuf_release(&buf);
 | 
			
		||||
	strbuf_release(&dashes);
 | 
			
		||||
	strbuf_release(&indent);
 | 
			
		||||
	opts.no_free = 0;
 | 
			
		||||
	diff_free(&opts);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int show_range_diff(const char *range1, const char *range2,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue