Merge branch 'ab/plug-leak-in-revisions'
Plug the memory leaks from the trickiest API of all, the revision walker. * ab/plug-leak-in-revisions: (27 commits) revisions API: add a TODO for diff_free(&revs->diffopt) revisions API: have release_revisions() release "topo_walk_info" revisions API: have release_revisions() release "date_mode" revisions API: call diff_free(&revs->pruning) in revisions_release() revisions API: release "reflog_info" in release revisions() revisions API: clear "boundary_commits" in release_revisions() revisions API: have release_revisions() release "prune_data" revisions API: have release_revisions() release "grep_filter" revisions API: have release_revisions() release "filter" revisions API: have release_revisions() release "cmdline" revisions API: have release_revisions() release "mailmap" revisions API: have release_revisions() release "commits" revisions API users: use release_revisions() for "prune_data" users revisions API users: use release_revisions() with UNLEAK() revisions API users: use release_revisions() in builtin/log.c revisions API users: use release_revisions() in http-push.c revisions API users: add "goto cleanup" for release_revisions() stash: always have the owner of "stash_info" free it revisions API users: use release_revisions() needing REV_INFO_INIT revision.[ch]: document and move code declared around "init" ...
This commit is contained in:
26
sequencer.c
26
sequencer.c
@ -1346,6 +1346,7 @@ void print_commit_summary(struct repository *r,
|
||||
log_tree_commit(&rev, commit);
|
||||
}
|
||||
|
||||
release_revisions(&rev);
|
||||
strbuf_release(&format);
|
||||
}
|
||||
|
||||
@ -3414,6 +3415,7 @@ static int make_patch(struct repository *r,
|
||||
unuse_commit_buffer(commit, commit_buffer);
|
||||
}
|
||||
strbuf_release(&buf);
|
||||
release_revisions(&log_tree_opt);
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -4524,6 +4526,7 @@ cleanup_head_ref:
|
||||
&log_tree_opt.diffopt);
|
||||
log_tree_diff_flush(&log_tree_opt);
|
||||
}
|
||||
release_revisions(&log_tree_opt);
|
||||
}
|
||||
flush_rewritten_pending();
|
||||
if (!stat(rebase_path_rewritten_list(), &st) &&
|
||||
@ -5350,6 +5353,7 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,
|
||||
int rebase_merges = flags & TODO_LIST_REBASE_MERGES;
|
||||
int reapply_cherry_picks = flags & TODO_LIST_REAPPLY_CHERRY_PICKS;
|
||||
int skipped_commit = 0;
|
||||
int ret = 0;
|
||||
|
||||
repo_init_revisions(r, &revs, NULL);
|
||||
revs.verbose_header = 1;
|
||||
@ -5373,14 +5377,20 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,
|
||||
pp.fmt = revs.commit_format;
|
||||
pp.output_encoding = get_log_output_encoding();
|
||||
|
||||
if (setup_revisions(argc, argv, &revs, NULL) > 1)
|
||||
return error(_("make_script: unhandled options"));
|
||||
if (setup_revisions(argc, argv, &revs, NULL) > 1) {
|
||||
ret = error(_("make_script: unhandled options"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (prepare_revision_walk(&revs) < 0)
|
||||
return error(_("make_script: error preparing revisions"));
|
||||
if (prepare_revision_walk(&revs) < 0) {
|
||||
ret = error(_("make_script: error preparing revisions"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (rebase_merges)
|
||||
return make_script_with_merges(&pp, &revs, out, flags);
|
||||
if (rebase_merges) {
|
||||
ret = make_script_with_merges(&pp, &revs, out, flags);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
while ((commit = get_revision(&revs))) {
|
||||
int is_empty = is_original_commit_empty(commit);
|
||||
@ -5404,7 +5414,9 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,
|
||||
if (skipped_commit)
|
||||
advise_if_enabled(ADVICE_SKIPPED_CHERRY_PICKS,
|
||||
_("use --reapply-cherry-picks to include skipped commits"));
|
||||
return 0;
|
||||
cleanup:
|
||||
release_revisions(&revs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user