Merge branch 'ps/leakfixes-part-4'
More leak fixes. * ps/leakfixes-part-4: (22 commits) builtin/diff: free symmetric diff members diff: free state populated via options builtin/log: fix leak when showing converted blob contents userdiff: fix leaking memory for configured diff drivers builtin/format-patch: fix various trivial memory leaks diff: fix leak when parsing invalid ignore regex option unpack-trees: clear index when not propagating it sequencer: release todo list on error paths merge-ort: unconditionally release attributes index builtin/fast-export: plug leaking tag names builtin/fast-export: fix leaking diff options builtin/fast-import: plug trivial memory leaks builtin/notes: fix leaking `struct notes_tree` when merging notes builtin/rebase: fix leaking `commit.gpgsign` value config: fix leaking comment character config submodule-config: fix leaking name entry when traversing submodules read-cache: fix leaking hashfile when writing index fails bulk-checkin: fix leaking state TODO object-name: fix leaking symlink paths in object context object-file: fix memory leak when reading corrupted headers ...
This commit is contained in:
@ -805,7 +805,7 @@ static int merge_commit(struct notes_merge_options *o)
|
||||
{
|
||||
struct strbuf msg = STRBUF_INIT;
|
||||
struct object_id oid, parent_oid;
|
||||
struct notes_tree *t;
|
||||
struct notes_tree t = {0};
|
||||
struct commit *partial;
|
||||
struct pretty_print_context pretty_ctx;
|
||||
void *local_ref_to_free;
|
||||
@ -828,8 +828,7 @@ static int merge_commit(struct notes_merge_options *o)
|
||||
else
|
||||
oidclr(&parent_oid, the_repository->hash_algo);
|
||||
|
||||
CALLOC_ARRAY(t, 1);
|
||||
init_notes(t, "NOTES_MERGE_PARTIAL", combine_notes_overwrite, 0);
|
||||
init_notes(&t, "NOTES_MERGE_PARTIAL", combine_notes_overwrite, 0);
|
||||
|
||||
o->local_ref = local_ref_to_free =
|
||||
refs_resolve_refdup(get_main_ref_store(the_repository),
|
||||
@ -837,7 +836,7 @@ static int merge_commit(struct notes_merge_options *o)
|
||||
if (!o->local_ref)
|
||||
die(_("failed to resolve NOTES_MERGE_REF"));
|
||||
|
||||
if (notes_merge_commit(o, t, partial, &oid))
|
||||
if (notes_merge_commit(o, &t, partial, &oid))
|
||||
die(_("failed to finalize notes merge"));
|
||||
|
||||
/* Reuse existing commit message in reflog message */
|
||||
@ -851,7 +850,7 @@ static int merge_commit(struct notes_merge_options *o)
|
||||
is_null_oid(&parent_oid) ? NULL : &parent_oid,
|
||||
0, UPDATE_REFS_DIE_ON_ERR);
|
||||
|
||||
free_notes(t);
|
||||
free_notes(&t);
|
||||
strbuf_release(&msg);
|
||||
ret = merge_abort(o);
|
||||
free(local_ref_to_free);
|
||||
|
Reference in New Issue
Block a user