Skip to content

Commit 84e9fc3

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 355b319 commit 84e9fc3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

builtin/gc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,9 +1476,9 @@ static int maintenance_run_tasks(struct maintenance_run_opts *opts,
14761476

14771477
static void initialize_maintenance_strategy(void)
14781478
{
1479-
char *config_str;
1479+
const char *config_str;
14801480

1481-
if (git_config_get_string("maintenance.strategy", &config_str))
1481+
if (git_config_get_string_tmp("maintenance.strategy", &config_str))
14821482
return;
14831483

14841484
if (!strcasecmp(config_str, "incremental")) {

0 commit comments

Comments
 (0)