зеркало из https://github.com/microsoft/git.git
config: plug user_config leak
We generate filenames for the user_config ("~/.gitconfig") and the xdg config ("$XDG_CONFIG_HOME/git/config") and then decide which to use by looking at the filesystem. But after selecting one, the unused string is just leaked. This is a tiny leak, but it creates noise in leak-checker output. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
baddc96b2c
Коммит
6c6b08d269
|
@ -518,10 +518,13 @@ int cmd_config(int argc, const char **argv, const char *prefix)
|
||||||
die("$HOME not set");
|
die("$HOME not set");
|
||||||
|
|
||||||
if (access_or_warn(user_config, R_OK, 0) &&
|
if (access_or_warn(user_config, R_OK, 0) &&
|
||||||
xdg_config && !access_or_warn(xdg_config, R_OK, 0))
|
xdg_config && !access_or_warn(xdg_config, R_OK, 0)) {
|
||||||
given_config_source.file = xdg_config;
|
given_config_source.file = xdg_config;
|
||||||
else
|
free(user_config);
|
||||||
|
} else {
|
||||||
given_config_source.file = user_config;
|
given_config_source.file = user_config;
|
||||||
|
free(xdg_config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (use_system_config)
|
else if (use_system_config)
|
||||||
given_config_source.file = git_etc_gitconfig();
|
given_config_source.file = git_etc_gitconfig();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче