Browse Source

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>
maint
Stefan Beller 7 years ago committed by Junio C Hamano
parent
commit
e6be8e2f9f
  1. 3
      builtin/submodule--helper.c

3
builtin/submodule--helper.c

@ -55,7 +55,7 @@ static char *get_default_remote(void) @@ -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) @@ -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;
}


Loading…
Cancel
Save