mirror of
https://github.com/git/git.git
synced 2026-01-12 05:43:12 +09:00
builtin/maintenance: fix leaking config string
When parsing the maintenance strategy from config we allocate a config string, but do not free it after parsing it. Plug this leak by instead using `git_config_get_string_tmp()`, which does not allocate any memory. This leak is exposed by t7900, but plugging it alone does not make the test suite pass. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
355b3190ee
commit
84e9fc361d
@ -1476,9 +1476,9 @@ static int maintenance_run_tasks(struct maintenance_run_opts *opts,
|
||||
|
||||
static void initialize_maintenance_strategy(void)
|
||||
{
|
||||
char *config_str;
|
||||
const char *config_str;
|
||||
|
||||
if (git_config_get_string("maintenance.strategy", &config_str))
|
||||
if (git_config_get_string_tmp("maintenance.strategy", &config_str))
|
||||
return;
|
||||
|
||||
if (!strcasecmp(config_str, "incremental")) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user