Merge branch 'ab/various-leak-fixes'
Leak fixes. * ab/various-leak-fixes: push: free_refs() the "local_refs" in set_refspecs() push: refactor refspec_append_mapped() for subsequent leak-fix receive-pack: release the linked "struct command *" list grep API: plug memory leaks by freeing "header_list" grep.c: refactor free_grep_patterns() builtin/merge.c: free "&buf" on "Your local changes..." error builtin/merge.c: use fixed strings, not "strbuf", fix leak show-branch: free() allocated "head" before return commit-graph: fix a parse_options_concat() leak http-backend.c: fix cmd_main() memory leak, refactor reg{exec,free}() http-backend.c: fix "dir" and "cmd_arg" leaks in cmd_main() worktree: fix a trivial leak in prune_worktrees() repack: fix leaks on error with "goto cleanup" name-rev: don't xstrdup() an already dup'd string various: add missing clear_pathspec(), fix leaks clone: use free() instead of UNLEAK() commit-graph: use free_commit_graph() instead of UNLEAK() bundle.c: don't leak the "args" in the "struct child_process" tests: mark tests as passing with SANITIZE=leak
This commit is contained in:
@ -1560,7 +1560,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
!common->next &&
|
||||
oideq(&common->item->object.oid, &head_commit->object.oid)) {
|
||||
/* Again the most common case of merging one remote. */
|
||||
struct strbuf msg = STRBUF_INIT;
|
||||
const char *msg = have_message ?
|
||||
"Fast-forward (no commit created; -m option ignored)" :
|
||||
"Fast-forward";
|
||||
struct commit *commit;
|
||||
|
||||
if (verbosity >= 0) {
|
||||
@ -1570,10 +1572,6 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
find_unique_abbrev(&remoteheads->item->object.oid,
|
||||
DEFAULT_ABBREV));
|
||||
}
|
||||
strbuf_addstr(&msg, "Fast-forward");
|
||||
if (have_message)
|
||||
strbuf_addstr(&msg,
|
||||
" (no commit created; -m option ignored)");
|
||||
commit = remoteheads->item;
|
||||
if (!commit) {
|
||||
ret = 1;
|
||||
@ -1592,9 +1590,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
goto done;
|
||||
}
|
||||
|
||||
finish(head_commit, remoteheads, &commit->object.oid, msg.buf);
|
||||
finish(head_commit, remoteheads, &commit->object.oid, msg);
|
||||
remove_merge_branch_state(the_repository);
|
||||
strbuf_release(&msg);
|
||||
goto done;
|
||||
} else if (!remoteheads->next && common->next)
|
||||
;
|
||||
@ -1621,7 +1618,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
error(_("Your local changes to the following files would be overwritten by merge:\n %s"),
|
||||
sb.buf);
|
||||
strbuf_release(&sb);
|
||||
return 2;
|
||||
ret = 2;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* See if it is really trivial. */
|
||||
|
Reference in New Issue
Block a user