Re: [PATCH 1/1] maintenance: fix a SEGFAULT when no repository
On Tue, Nov 24, 2020 at 08:03:33PM +0100, Martin Ågren wrote:
Show 18 quoted lines
> On Tue, 24 Nov 2020 at 17:47, Rafael Silva <rafaeloliveira.cs@gmail.com> 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.