diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-02-22 14:55:45 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-22 14:55:45 -0800 |
commit | 72972ea0b978f20b335339d18e497da617398967 (patch) | |
tree | 770e98011633bc27a1ef54b51cd2752b0f80acc6 /builtin/stash.c | |
parent | 6aac634f818a35414c7541d86039e29aa0aa7562 (diff) | |
parent | c65d18cb5259079f44c055c07bf46c13c75780c1 (diff) | |
download | git-72972ea0b978f20b335339d18e497da617398967.tar.gz |
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
Diffstat (limited to 'builtin/stash.c')
-rw-r--r-- | builtin/stash.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin/stash.c b/builtin/stash.c index f93d04f11e..3a4f9fd566 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -1731,6 +1731,7 @@ static int push_stash(int argc, const char **argv, const char *prefix, OPT_PATHSPEC_FILE_NUL(&pathspec_file_nul), OPT_END() }; + int ret; if (argc) { force_assume = !strcmp(argv[0], "-p"); @@ -1770,8 +1771,10 @@ static int push_stash(int argc, const char **argv, const char *prefix, die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file"); } - return do_push_stash(&ps, stash_msg, quiet, keep_index, patch_mode, - include_untracked, only_staged); + ret = do_push_stash(&ps, stash_msg, quiet, keep_index, patch_mode, + include_untracked, only_staged); + clear_pathspec(&ps); + return ret; } static int push_stash_unassumed(int argc, const char **argv, const char *prefix) |