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>
Stefan Beller committed
May 30, 2018 at 10:03 UTC
e6be8e2f9f87fbd6a4f58ac3cda4558563833088
1 file changed
+2
-1
builtin/submodule--helper.c
+2
-1
@@ -55,7 +55,7 @@ static char *get_default_remote(void)
55
56
static int print_default_remote(int argc, const char **argv, const char *prefix)
57
{
58
- const char *remote;
58
+ char *remote;
59
60
if (argc != 1)
61
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)
64
if (remote)
65
printf("%s\n", remote);
66
67
+ free(remote);
68
return 0;
69
}
70