From: Rafael Silva Date: Thu, 26 Nov 2020 07:07:44 GMT Subject: Re: [PATCH 1/1] maintenance: fix a SEGFAULT when no repository Message-ID: <20201126070744.4vwesc5dpnnl7u5v@contrib-buster.localdomain> In-Reply-To: On Tue, Nov 24, 2020 at 08:03:33PM +0100, Martin Ă…gren wrote: > On Tue, 24 Nov 2020 at 17:47, Rafael Silva wrote: > > @@ -1265,9 +1265,14 @@ static int maintenance_run_tasks(struct maintenance_run_opts *opts) > > { > > int i, found_selected = 0; > > int result = 0; > > + char *lock_path; > > struct lock_file lk; > > struct repository *r = the_repository; > > - char *lock_path = xstrfmt("%s/maintenance", r->objects->odb->path); > > + > > + if (!r || !r->gitdir) > > + return error(_("not a git repository")); > > + > > + lock_path = xstrfmt("%s/maintenance", the_repository->objects->odb->path); > > s/the_repository/r/ > > (The preimage uses "r" and you check using "r".) Thanks. will revise this in the next patch version.