Re: [PATCH v4 5/7] builtin/maintenance: introduce "worktree-prune" task

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 06, 2025 at 09:40:55AM +0200, Christian Couder wrote:
> On Mon, May 5, 2025 at 10:52 AM Patrick Steinhardt <ps@xxxxxx> wrote:
> 
> > +static int worktree_prune_condition(struct gc_config *cfg)
> > +{
> > +       struct strvec worktrees = STRVEC_INIT;
> > +       struct strbuf reason = STRBUF_INIT;
> > +       timestamp_t expiry_date;
> > +       int should_prune = 0;
> > +       int limit = 1;
> > +
> > +       git_config_get_int("maintenance.worktree-prune.auto", &limit);
> > +       if (limit <= 0) {
> > +               should_prune = limit < 0;
> > +               goto out;
> > +       }
> > +
> > +       if (parse_expiry_date(cfg->prune_worktrees_expire, &expiry_date) ||
> > +           get_worktree_names(the_repository, &worktrees) < 0)
> > +               goto out;
> > +
> > +       for (size_t i = 0; i < worktrees.nr; i++) {
> > +               char *wtpath;
> > +
> > +               strbuf_reset(&reason);
> > +               if (should_prune_worktree(worktrees.v[i], &reason, &wtpath, expiry_date)) {
> > +                       limit--;
> > +
> > +                       if (!limit) {
> > +                               should_prune = 1;
> > +                               goto out;
> 
> Eric noticed in a previous round that wtpath is leaked in this `goto
> out` path, and it seems to me that it's still the case.

Yeah, our mails had crossed back then. Fixed now.

Patrick




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux