From e6be8e2f9f87fbd6a4f58ac3cda4558563833088 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Wed, 30 May 2018 10:03:02 -0700 Subject: [PATCH] submodule--helper: plug mem leak in print_default_remote Signed-off-by: Stefan Beller Acked-by: Johannes Schindelin [jc: no need for remote to be const char *] Signed-off-by: Junio C Hamano --- builtin/submodule--helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index bd250ca216..7a752dbf9d 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -55,7 +55,7 @@ static char *get_default_remote(void) static int print_default_remote(int argc, const char **argv, const char *prefix) { - const char *remote; + char *remote; if (argc != 1) die(_("submodule--helper print-default-remote takes no arguments")); @@ -64,6 +64,7 @@ static int print_default_remote(int argc, const char **argv, const char *prefix) if (remote) printf("%s\n", remote); + free(remote); return 0; } -- 2.11.4.GIT