Re: [PATCH] builtin/init-db: preemptively clear repo_fmt to avoid leaks
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 5, 2021, 19:28 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2105052125452.50@tvgsbejvaqbjf.bet>
- In-Reply-To
- <pull.1018.git.git.1620240022594.gitgitgadget@gmail.com>
Hi Andrzej,
On Wed, 5 May 2021, Andrzej Hunt via GitGitGadget wrote:
Show 9 quoted lines
> diff --git a/builtin/init-db.c b/builtin/init-db.c > index 31b718259a64..b25147ebaf59 100644 > --- a/builtin/init-db.c > +++ b/builtin/init-db.c > @@ -512,6 +512,7 @@ int init_db(const char *git_dir, const char *real_git_dir, > git_dir, len && git_dir[len-1] != '/' ? "/" : ""); > } > > + clear_repository_format(&repo_fmt);
I am afraid that this might not be correct, as t0410.27 experienced a segmentation fault (see https://github.com/git/git/pull/1018/checks?check_run_id=2511749719#step:5:2845 for the full details):
-- snip -- [...] + repack_and_check -a bd6a66906d425462f8fbf1e3a61cda48cc4e456c 3251618c5193c77083052fb7d6ed5e8b0b227a94 + rm -rf repo2 + cp -r repo repo2 + git -C repo2 repack -a -d warning: reflog of 'HEAD' references pruned commits warning: reflog of 'refs/heads/master' references pruned commits Segmentation fault (core dumped) error: last command exited with $?=139 not ok 27 - repack -d does not irreversibly delete promisor objects -- snap --
When I encountered similar problems with my patches in the past, I found the `--valgrind-only` option incredibly useful, i.e. something like
cd t && sh t0410-*.sh -i -v -x --valgrind-only=27
Maybe you can give it a try?
Ciao, Dscho
Show 9 quoted lines
> free(original_git_dir); > return 0; > } > > base-commit: c3901c8daf043cdc16ffb20d3a410f3a2d5494fd > -- > gitgitgadget > >