diff options
| author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-07-01 12:42:58 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-07-01 11:43:43 -0700 |
| commit | 55916bba0f4805a3bd0c1891c48effbfe1d12536 (patch) | |
| tree | 3a5420c67fe14d09606382ffc9e974c6ad465dbd | |
| parent | 33d0dda633f3748e1af517135a72141f5df35f2d (diff) | |
| download | git-55916bba0f4805a3bd0c1891c48effbfe1d12536.tar.xz | |
gc: fix a memory leak
Fix a memory leak in code added in 41abfe15d95 (maintenance: add
pack-refs task, 2021-02-09), we need to call strvec_clear() on the
"struct strvec" that we initialized.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rw-r--r-- | builtin/gc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/builtin/gc.c b/builtin/gc.c index 021e9256ae..eeff2b760e 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -168,9 +168,15 @@ struct maintenance_run_opts; static int maintenance_task_pack_refs(MAYBE_UNUSED struct maintenance_run_opts *opts) { struct strvec pack_refs_cmd = STRVEC_INIT; + int ret; + strvec_pushl(&pack_refs_cmd, "pack-refs", "--all", "--prune", NULL); - return run_command_v_opt(pack_refs_cmd.v, RUN_GIT_CMD); + ret = run_command_v_opt(pack_refs_cmd.v, RUN_GIT_CMD); + + strvec_clear(&pack_refs_cmd); + + return ret; } static int too_many_loose_objects(void) |
