[PATCH 2/2] git-rev-parse: use leaky().
- From
Pierre Habouzit <madcoder@debian.org>
- Date
- Jun 24, 2008, 20:14 UTC
- Message-ID
- <1214338474-16822-3-git-send-email-madcoder@debian.org>
- 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