Skip to content

Commit e6be8e2

Browse files
stefanbellergitster
authored andcommitted
submodule--helper: plug mem leak in print_default_remote
Signed-off-by: Stefan Beller <[email protected]> Acked-by: Johannes Schindelin <[email protected]> [jc: no need for remote to be const char *] Signed-off-by: Junio C Hamano <[email protected]>
1 parent 09427e8 commit e6be8e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

builtin/submodule--helper.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static char *get_default_remote(void)
5555

5656
static int print_default_remote(int argc, const char **argv, const char *prefix)
5757
{
58-
const char *remote;
58+
char *remote;
5959

6060
if (argc != 1)
6161
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)
6464
if (remote)
6565
printf("%s\n", remote);
6666

67+
free(remote);
6768
return 0;
6869
}
6970

0 commit comments

Comments
 (0)