From: Stefan Sperling Subject: Re: cache pack index file list when repository is opened To: Omar Polo Cc: gameoftrees@openbsd.org Date: Mon, 14 Mar 2022 14:25:09 +0100 On Mon, Mar 14, 2022 at 12:08:23AM +0100, Omar Polo wrote: > There's just a minor thing that caught my attention while reading the > parts affected by the diff, but it was already there. If the repo > allocation in got_repo_open fails the `goto done' ends up calling > got_repo_close with repo == NULL and segfaulting there. > > ok? Yes, thanks! > diff 43a61642701486d74f4bb5846d07295818e1150c /home/op/w/got (staged changes) > blob - d4175545865a20ba9a3cff43736298aaae5e8c37 > blob + e8a00ae9b1dab853c73f41060bc6ab6883e8e6f2 > --- lib/repository.c > +++ lib/repository.c > @@ -664,10 +664,8 @@ got_repo_open(struct got_repository **repop, const cha > return got_error_from_errno("getrlimit"); > > repo = calloc(1, sizeof(*repo)); > - if (repo == NULL) { > - err = got_error_from_errno("calloc"); > - goto done; > - } > + if (repo == NULL) > + return got_error_from_errno("calloc"); > > RB_INIT(&repo->packidx_bloom_filters); > > >