From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH] parse-options-cb.c: use string_list_append_nodup in OPT_STRING_LIST()
Date: Fri, 10 Jun 2016 18:57:26 +0700 [thread overview]
Message-ID: <20160610115726.4805-1-pclouds@gmail.com> (raw)
If the given string list has strdup_strings set (*), the string will be
duplicated again. Pointless and leak memory. Ignore that flag.
(*) only interpret-trailers.c does it at the moment
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
parse-options-cb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parse-options-cb.c b/parse-options-cb.c
index 239898d..8a1b6e6 100644
--- a/parse-options-cb.c
+++ b/parse-options-cb.c
@@ -144,7 +144,7 @@ int parse_opt_string_list(const struct option *opt, const char *arg, int unset)
if (!arg)
return -1;
- string_list_append(v, xstrdup(arg));
+ string_list_append_nodup(v, xstrdup(arg));
return 0;
}
--
2.8.2.524.g6ff3d78
next reply other threads:[~2016-06-10 11:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-10 11:57 Nguyễn Thái Ngọc Duy [this message]
2016-06-12 22:03 ` [PATCH] parse-options-cb.c: use string_list_append_nodup in OPT_STRING_LIST() Jeff King
2016-06-13 0:08 ` Duy Nguyen
2016-06-13 5:32 ` [PATCH 0/3] fix parse-opt string_list leaks Jeff King
2016-06-13 5:39 ` [PATCH 1/3] parse_opt_string_list: stop allocating new strings Jeff King
2016-06-13 5:39 ` [PATCH 2/3] interpret-trailers: don't duplicate option strings Jeff King
2016-06-13 5:39 ` [PATCH 3/3] blame,shortlog: don't make local option variables static Jeff King
2016-06-14 4:32 ` Eric Sunshine
2016-06-14 5:05 ` Jeff King
2016-08-02 10:52 ` [PATCH] blame: drop strdup of string literal Jeff King
2016-08-03 7:36 ` Eric Sunshine
2016-06-13 9:36 ` [PATCH 0/3] fix parse-opt string_list leaks Duy Nguyen
2016-06-13 10:04 ` [PATCH 4/3] use string_list initializer consistently Jeff King
2016-06-13 11:31 ` Duy Nguyen
2016-06-13 17:32 ` Jeff King
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=20160610115726.4805-1-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.