From: Stefan Beller <stefanbel...@gmail.com>

Signed-off-by: Stefan Beller <sbel...@google.com>
---
 builtin/rev-parse.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index c961b74..3296d22 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -371,7 +371,7 @@ static int cmd_parseopt(int argc, const char **argv, const 
char *prefix)
        static const char * const flag_chars = "*=?!";
 
        struct strbuf sb = STRBUF_INIT, parsed = STRBUF_INIT;
-       const char **usage = NULL;
+       const char **usage = NULL, **curr_usage;
        struct option *opts = NULL;
        int onb = 0, osz = 0, unb = 0, usz = 0;
 
@@ -472,6 +472,16 @@ static int cmd_parseopt(int argc, const char **argv, const 
char *prefix)
        strbuf_addf(&parsed, " --");
        sq_quote_argv(&parsed, argv, 0);
        puts(parsed.buf);
+
+#ifdef FREE_ALL_MEMORY
+       curr_usage = usage;
+       while (curr_usage) {
+               free(*curr_usage);
+               curr_usage++;
+       }
+       free(usage);
+#endif
+
        return 0;
 }
 
-- 
2.8.2.401.g9c0faef

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to