Merge branch 'ab/diff-deferred-free'
A small memleak in "diff -I<regexp>" has been corrected. * ab/diff-deferred-free: diff: plug memory leak from regcomp() on {log,diff} -I diff: add an API for deferred freeing
This commit is contained in:
@ -307,10 +307,11 @@ static struct itimerval early_output_timer;
|
||||
|
||||
static void log_show_early(struct rev_info *revs, struct commit_list *list)
|
||||
{
|
||||
int i = revs->early_output, close_file = revs->diffopt.close_file;
|
||||
int i = revs->early_output;
|
||||
int show_header = 1;
|
||||
int no_free = revs->diffopt.no_free;
|
||||
|
||||
revs->diffopt.close_file = 0;
|
||||
revs->diffopt.no_free = 0;
|
||||
sort_in_topological_order(&list, revs->sort_order);
|
||||
while (list && i) {
|
||||
struct commit *commit = list->item;
|
||||
@ -327,8 +328,8 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)
|
||||
case commit_ignore:
|
||||
break;
|
||||
case commit_error:
|
||||
if (close_file)
|
||||
fclose(revs->diffopt.file);
|
||||
revs->diffopt.no_free = no_free;
|
||||
diff_free(&revs->diffopt);
|
||||
return;
|
||||
}
|
||||
list = list->next;
|
||||
@ -336,8 +337,8 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)
|
||||
|
||||
/* Did we already get enough commits for the early output? */
|
||||
if (!i) {
|
||||
if (close_file)
|
||||
fclose(revs->diffopt.file);
|
||||
revs->diffopt.no_free = 0;
|
||||
diff_free(&revs->diffopt);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -401,7 +402,7 @@ static int cmd_log_walk(struct rev_info *rev)
|
||||
{
|
||||
struct commit *commit;
|
||||
int saved_nrl = 0;
|
||||
int saved_dcctc = 0, close_file = rev->diffopt.close_file;
|
||||
int saved_dcctc = 0;
|
||||
|
||||
if (rev->early_output)
|
||||
setup_early_output();
|
||||
@ -417,7 +418,7 @@ static int cmd_log_walk(struct rev_info *rev)
|
||||
* and HAS_CHANGES being accumulated in rev->diffopt, so be careful to
|
||||
* retain that state information if replacing rev->diffopt in this loop
|
||||
*/
|
||||
rev->diffopt.close_file = 0;
|
||||
rev->diffopt.no_free = 1;
|
||||
while ((commit = get_revision(rev)) != NULL) {
|
||||
if (!log_tree_commit(rev, commit) && rev->max_count >= 0)
|
||||
/*
|
||||
@ -442,8 +443,8 @@ static int cmd_log_walk(struct rev_info *rev)
|
||||
}
|
||||
rev->diffopt.degraded_cc_to_c = saved_dcctc;
|
||||
rev->diffopt.needed_rename_limit = saved_nrl;
|
||||
if (close_file)
|
||||
fclose(rev->diffopt.file);
|
||||
rev->diffopt.no_free = 0;
|
||||
diff_free(&rev->diffopt);
|
||||
|
||||
if (rev->diffopt.output_format & DIFF_FORMAT_CHECKDIFF &&
|
||||
rev->diffopt.flags.check_failed) {
|
||||
@ -1961,7 +1962,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||
* file, but but we must instruct it not to close after each
|
||||
* diff.
|
||||
*/
|
||||
rev.diffopt.close_file = 0;
|
||||
rev.diffopt.no_free = 1;
|
||||
} else {
|
||||
int saved;
|
||||
|
||||
|
Reference in New Issue
Block a user