summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Stefan Beller <sbeller@google.com>2018-05-30 10:03:02 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-06-01 14:52:47 +0900
commite6be8e2f9f87fbd6a4f58ac3cda4558563833088 (patch)
tree1c1f7716df33870b8b1795f05d15f6304db12263
parentrefs/packed-backend.c: close fd of empty file (diff)
downloadtgif-e6be8e2f9f87fbd6a4f58ac3cda4558563833088.tar.xz
submodule--helper: plug mem leak in print_default_remote
Signed-off-by: Stefan Beller <sbeller@google.com> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> [jc: no need for remote to be const char *] Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/submodule--helper.c3
1 files changed, 2 insertions, 1 deletions
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;
}