From: Pierre Habouzit <madcoder@debian.org>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Pierre Habouzit <madcoder@debian.org>
Subject: [PATCH 2/2] git-rev-parse: use leaky().
Date: Tue, 24 Jun 2008 22:14:34 +0200 [thread overview]
Message-ID: <1214338474-16822-3-git-send-email-madcoder@debian.org> (raw)
In-Reply-To: <1214338474-16822-2-git-send-email-madcoder@debian.org>
Mark the mallocs that cmd_parseopt never frees as leaky so that nobody
loses time trying to fix them.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
builtin-rev-parse.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index a7860ed..02defbb 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -319,12 +319,12 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
s = strchr(sb.buf, ' ');
if (!s || *sb.buf == ' ') {
o->type = OPTION_GROUP;
- o->help = xstrdup(skipspaces(sb.buf));
+ o->help = leaky(xstrdup(skipspaces(sb.buf)));
continue;
}
o->type = OPTION_CALLBACK;
- o->help = xstrdup(skipspaces(s));
+ o->help = leaky(xstrdup(skipspaces(s)));
o->value = &parsed;
o->flags = PARSE_OPT_NOARG;
o->callback = &parseopt_dump;
@@ -349,10 +349,10 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
if (s - sb.buf == 1) /* short option only */
o->short_name = *sb.buf;
else if (sb.buf[1] != ',') /* long option only */
- o->long_name = xmemdupz(sb.buf, s - sb.buf);
+ o->long_name = leaky(xmemdupz(sb.buf, s - sb.buf));
else {
o->short_name = *sb.buf;
- o->long_name = xmemdupz(sb.buf + 2, s - sb.buf - 2);
+ o->long_name = leaky(xmemdupz(sb.buf + 2, s - sb.buf - 2));
}
}
strbuf_release(&sb);
--
1.5.6.120.g3adb8.dirty
next prev parent reply other threads:[~2008-06-24 20:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 20:14 [RFC] leaky() Pierre Habouzit
2008-06-24 20:14 ` [PATCH 1/2] Introduce leaky() Pierre Habouzit
2008-06-24 20:14 ` Pierre Habouzit [this message]
2008-06-24 20:16 ` Pierre Habouzit
2008-06-24 21:28 ` Jakub Narebski
2008-06-24 22:10 ` Pierre Habouzit
2008-06-26 18:46 ` Junio C Hamano
2008-06-26 21:33 ` Pierre Habouzit
2008-07-22 18:09 ` Jan Hudec
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=1214338474-16822-3-git-send-email-madcoder@debian.org \
--to=madcoder@debian.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).