Subject: [PATCH 2/2] git-rev-parse: use leaky().

From: Pierre Habouzit <[email-masked]>
Date: Tue, 24 Jun 2008 22:14:34 +0200

Mark the mallocs that cmd_parseopt never frees as leaky so that nobody
loses time trying to fix them.

Signed-off-by: Pierre Habouzit <[email-masked]>
---
 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