From: "Andrzej Hunt via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Eric Sunshine" <sunshine@sunshineco.com>,
"Martin Ågren" <martin.agren@gmail.com>,
"Andrzej Hunt" <andrzej@ahunt.org>
Subject: [PATCH v3 0/9] Fix all leaks in t0001
Date: Sun, 21 Mar 2021 16:58:28 +0000 [thread overview]
Message-ID: <pull.899.v3.git.1616345918.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.899.v2.git.1615747662.gitgitgadget@gmail.com>
V3:
* Ensures we don't silently change enum values in "parse-options: convert
bitfield values to use binary shift". Instead we retain the original
values in that patch, and reuse the unused value in a later patch.
* Fixes some silly commit message typos.
Thanks as always for the sharp-eyed reviews.
ATB, Andrzej
Andrzej Hunt (9):
symbolic-ref: don't leak shortened refname in check_symref()
reset: free instead of leaking unneeded ref
clone: free or UNLEAK further pointers when finished
worktree: fix leak in dwim_branch()
init: remove git_init_db_config() while fixing leaks
init-db: silence template_dir leak when converting to absolute path
parse-options: convert bitfield values to use binary shift
parse-options: don't leak alias help messages
transport: also free remote_refs in transport_disconnect()
builtin/clone.c | 14 ++++++++++----
builtin/init-db.c | 32 ++++++++++----------------------
builtin/ls-remote.c | 4 ++--
builtin/remote.c | 8 ++++----
builtin/reset.c | 2 +-
builtin/symbolic-ref.c | 4 +++-
builtin/worktree.c | 10 ++++++----
parse-options.c | 19 ++++++++++++++++++-
parse-options.h | 35 ++++++++++++++++++-----------------
transport.c | 2 ++
10 files changed, 74 insertions(+), 56 deletions(-)
base-commit: 98164e9585e02e31dcf1377a553efe076c15f8c6
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-899%2Fahunt%2Fleaksan-t0001-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-899/ahunt/leaksan-t0001-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/899
Range-diff vs v2:
1: c7bb403ae381 = 1: 6af157dfed79 symbolic-ref: don't leak shortened refname in check_symref()
2: da05fc72b77a = 2: add6931b2138 reset: free instead of leaking unneeded ref
3: a74bbcae7363 = 3: 40c5c915fc1e clone: free or UNLEAK further pointers when finished
4: a10ab9e68809 = 4: 963f291d5344 worktree: fix leak in dwim_branch()
5: 206a82200ca1 = 5: b615fda790f0 init: remove git_init_db_config() while fixing leaks
6: aa345e50782f = 6: 953cc8f29885 init-db: silence template_dir leak when converting to absolute path
7: 2b03785bd4cb ! 7: c2220434ab2c parse-options: convert bitfield values to use binary shift
@@ Commit message
Also add a trailing comma to the last enum entry to simplify addition of
new flags.
- This changee was originally suggested by Peff in:
+ This change was originally suggested by Peff in:
https://public-inbox.org/git/YEZ%2FBWWbpfVwl6nO@coredump.intra.peff.net/
Signed-off-by: Andrzej Hunt <ajrhunt@google.com>
@@ parse-options.h: enum parse_opt_type {
+ PARSE_OPT_LASTARG_DEFAULT = 1 << 4,
+ PARSE_OPT_NODASH = 1 << 5,
+ PARSE_OPT_LITERAL_ARGHELP = 1 << 6,
-+ PARSE_OPT_SHELL_EVAL = 1 << 7,
-+ PARSE_OPT_NOCOMPLETE = 1 << 8,
-+ PARSE_OPT_COMP_ARG = 1 << 9,
-+ PARSE_OPT_CMDMODE = 1 << 10,
++ PARSE_OPT_SHELL_EVAL = 1 << 8,
++ PARSE_OPT_NOCOMPLETE = 1 << 9,
++ PARSE_OPT_COMP_ARG = 1 << 10,
++ PARSE_OPT_CMDMODE = 1 << 11,
};
enum parse_opt_result {
8: 4397c1fd8020 ! 8: 6e46cd332023 parse-options: don't leak alias help messages
@@ Commit message
Signed-off-by: Andrzej Hunt <ajrhunt@google.com>
- fold
-
## parse-options.c ##
@@ parse-options.c: static int show_gitcomp(const struct option *opts, int show_all)
*
@@ parse-options.c: static struct option *preprocess_options(struct parse_opt_ctx_t
+ return;
+
+ for (i = 0; options[i].type != OPTION_END; i++) {
-+ if (options[i].flags & PARSE_OPT_FROM_ALIAS) {
++ if (options[i].flags & PARSE_OPT_FROM_ALIAS)
+ free((void *)options[i].help);
-+ }
+ }
+ free(options);
+}
@@ parse-options.c: int parse_options(int argc, const char **argv, const char *pref
## parse-options.h ##
@@ parse-options.h: enum parse_opt_option_flags {
- PARSE_OPT_NOCOMPLETE = 1 << 8,
- PARSE_OPT_COMP_ARG = 1 << 9,
- PARSE_OPT_CMDMODE = 1 << 10,
-+ PARSE_OPT_FROM_ALIAS = 1 << 11,
- };
-
- enum parse_opt_result {
+ PARSE_OPT_LASTARG_DEFAULT = 1 << 4,
+ PARSE_OPT_NODASH = 1 << 5,
+ PARSE_OPT_LITERAL_ARGHELP = 1 << 6,
++ PARSE_OPT_FROM_ALIAS = 1 << 7,
+ PARSE_OPT_SHELL_EVAL = 1 << 8,
+ PARSE_OPT_NOCOMPLETE = 1 << 9,
+ PARSE_OPT_COMP_ARG = 1 << 10,
9: a907f2460d42 = 9: 50a2b9693aa3 transport: also free remote_refs in transport_disconnect()
--
gitgitgadget
next prev parent reply other threads:[~2021-03-21 16:59 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 18:36 [PATCH 0/7] Fix all leaks in t0001 Andrzej Hunt via GitGitGadget
2021-03-08 18:36 ` [PATCH 1/7] symbolic-ref: don't leak shortened refname in check_symref() Andrzej Hunt via GitGitGadget
2021-03-08 19:01 ` Jeff King
2021-03-14 18:07 ` Andrzej Hunt
2021-03-08 18:36 ` [PATCH 2/7] reset: free instead of leaking unneeded ref Andrzej Hunt via GitGitGadget
2021-03-08 19:03 ` Jeff King
2021-03-08 18:36 ` [PATCH 3/7] clone: free or UNLEAK further pointers when finished Andrzej Hunt via GitGitGadget
2021-03-08 19:12 ` Jeff King
2021-03-14 16:56 ` Andrzej Hunt
2021-03-08 18:36 ` [PATCH 4/7] worktree: fix leak in dwim_branch() Andrzej Hunt via GitGitGadget
2021-03-08 19:16 ` Jeff King
2021-03-14 17:56 ` Andrzej Hunt
2021-03-08 18:36 ` [PATCH 5/7] init: remove git_init_db_config() while fixing leaks Andrzej Hunt via GitGitGadget
2021-03-08 19:29 ` Jeff King
2021-03-08 18:36 ` [PATCH 6/7] init-db: silence template_dir leak when converting to absolute path Andrzej Hunt via GitGitGadget
2021-03-08 19:30 ` Jeff King
2021-03-08 18:36 ` [PATCH 7/7] parse-options: don't leak alias help messages Andrzej Hunt via GitGitGadget
2021-03-08 19:46 ` Jeff King
2021-03-14 17:03 ` Andrzej Hunt
2021-03-08 18:55 ` [PATCH 0/7] Fix all leaks in t0001 Jeff King
2021-03-12 23:42 ` Junio C Hamano
2021-03-14 16:54 ` Andrzej Hunt
2021-03-15 16:23 ` Andrzej Hunt
2021-03-08 18:57 ` Junio C Hamano
2021-03-14 16:55 ` Andrzej Hunt
2021-03-14 18:47 ` [PATCH v2 0/9] " Andrzej Hunt via GitGitGadget
2021-03-14 18:47 ` [PATCH v2 1/9] symbolic-ref: don't leak shortened refname in check_symref() Andrzej Hunt via GitGitGadget
2021-03-14 18:47 ` [PATCH v2 2/9] reset: free instead of leaking unneeded ref Andrzej Hunt via GitGitGadget
2021-03-14 18:47 ` [PATCH v2 3/9] clone: free or UNLEAK further pointers when finished Andrzej Hunt via GitGitGadget
2021-03-14 18:47 ` [PATCH v2 4/9] worktree: fix leak in dwim_branch() Andrzej Hunt via GitGitGadget
2021-03-14 18:47 ` [PATCH v2 5/9] init: remove git_init_db_config() while fixing leaks Andrzej Hunt via GitGitGadget
2021-03-14 18:47 ` [PATCH v2 6/9] init-db: silence template_dir leak when converting to absolute path Andrzej Hunt via GitGitGadget
2021-03-14 18:47 ` [PATCH v2 7/9] parse-options: convert bitfield values to use binary shift Andrzej Hunt via GitGitGadget
2021-03-14 20:25 ` Martin Ågren
2021-03-14 22:57 ` Junio C Hamano
2021-03-15 16:20 ` Andrzej Hunt
2021-03-14 18:47 ` [PATCH v2 8/9] parse-options: don't leak alias help messages Andrzej Hunt via GitGitGadget
2021-03-14 19:48 ` Eric Sunshine
2021-03-15 16:20 ` Andrzej Hunt
2021-03-14 20:00 ` Andrzej Hunt
2021-03-14 18:47 ` [PATCH v2 9/9] transport: also free remote_refs in transport_disconnect() Andrzej Hunt via GitGitGadget
2021-03-21 16:58 ` Andrzej Hunt via GitGitGadget [this message]
2021-03-21 16:58 ` [PATCH v3 1/9] symbolic-ref: don't leak shortened refname in check_symref() Andrzej Hunt via GitGitGadget
2021-03-21 16:58 ` [PATCH v3 2/9] reset: free instead of leaking unneeded ref Andrzej Hunt via GitGitGadget
2021-03-21 16:58 ` [PATCH v3 3/9] clone: free or UNLEAK further pointers when finished Andrzej Hunt via GitGitGadget
2021-03-21 16:58 ` [PATCH v3 4/9] worktree: fix leak in dwim_branch() Andrzej Hunt via GitGitGadget
2021-03-21 16:58 ` [PATCH v3 5/9] init: remove git_init_db_config() while fixing leaks Andrzej Hunt via GitGitGadget
2021-03-21 16:58 ` [PATCH v3 6/9] init-db: silence template_dir leak when converting to absolute path Andrzej Hunt via GitGitGadget
2021-03-21 16:58 ` [PATCH v3 7/9] parse-options: convert bitfield values to use binary shift Andrzej Hunt via GitGitGadget
2021-03-21 16:58 ` [PATCH v3 8/9] parse-options: don't leak alias help messages Andrzej Hunt via GitGitGadget
2021-03-21 16:58 ` [PATCH v3 9/9] transport: also free remote_refs in transport_disconnect() Andrzej Hunt via GitGitGadget
2021-03-21 21:40 ` [PATCH v3 0/9] Fix all leaks in t0001 Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.899.v3.git.1616345918.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=andrzej@ahunt.org \
--cc=git@vger.kernel.org \
--cc=martin.agren@gmail.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).