@@ -307,10 +307,11 @@ static struct itimerval early_output_timer;
307307
308308static void log_show_early (struct rev_info * revs , struct commit_list * list )
309309{
310- int i = revs -> early_output , close_file = revs -> diffopt . close_file ;
310+ int i = revs -> early_output ;
311311 int show_header = 1 ;
312+ int no_free = revs -> diffopt .no_free ;
312313
313- revs -> diffopt .close_file = 0 ;
314+ revs -> diffopt .no_free = 0 ;
314315 sort_in_topological_order (& list , revs -> sort_order );
315316 while (list && i ) {
316317 struct commit * commit = list -> item ;
@@ -327,17 +328,17 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)
327328 case commit_ignore :
328329 break ;
329330 case commit_error :
330- if ( close_file )
331- fclose ( revs -> diffopt . file );
331+ revs -> diffopt . no_free = no_free ;
332+ diff_free ( & revs -> diffopt );
332333 return ;
333334 }
334335 list = list -> next ;
335336 }
336337
337338 /* Did we already get enough commits for the early output? */
338339 if (!i ) {
339- if ( close_file )
340- fclose ( revs -> diffopt . file );
340+ revs -> diffopt . no_free = 0 ;
341+ diff_free ( & revs -> diffopt );
341342 return ;
342343 }
343344
@@ -401,7 +402,7 @@ static int cmd_log_walk(struct rev_info *rev)
401402{
402403 struct commit * commit ;
403404 int saved_nrl = 0 ;
404- int saved_dcctc = 0 , close_file = rev -> diffopt . close_file ;
405+ int saved_dcctc = 0 ;
405406
406407 if (rev -> early_output )
407408 setup_early_output ();
@@ -417,7 +418,7 @@ static int cmd_log_walk(struct rev_info *rev)
417418 * and HAS_CHANGES being accumulated in rev->diffopt, so be careful to
418419 * retain that state information if replacing rev->diffopt in this loop
419420 */
420- rev -> diffopt .close_file = 0 ;
421+ rev -> diffopt .no_free = 1 ;
421422 while ((commit = get_revision (rev )) != NULL ) {
422423 if (!log_tree_commit (rev , commit ) && rev -> max_count >= 0 )
423424 /*
@@ -442,8 +443,8 @@ static int cmd_log_walk(struct rev_info *rev)
442443 }
443444 rev -> diffopt .degraded_cc_to_c = saved_dcctc ;
444445 rev -> diffopt .needed_rename_limit = saved_nrl ;
445- if ( close_file )
446- fclose ( rev -> diffopt . file );
446+ rev -> diffopt . no_free = 0 ;
447+ diff_free ( & rev -> diffopt );
447448
448449 if (rev -> diffopt .output_format & DIFF_FORMAT_CHECKDIFF &&
449450 rev -> diffopt .flags .check_failed ) {
@@ -1961,7 +1962,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
19611962 * file, but but we must instruct it not to close after each
19621963 * diff.
19631964 */
1964- rev .diffopt .close_file = 0 ;
1965+ rev .diffopt .no_free = 1 ;
19651966 } else {
19661967 int saved ;
19671968
0 commit comments