Re: [PATCH 14/22] shallow: fix leaking members of `struct shallow_info`

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

 



On Thu, Aug 29, 2024 at 09:07:47AM -0700, Junio C Hamano wrote:
> Toon claes <toon@xxxxxxxxx> writes:
> 
> >>  void clear_shallow_info(struct shallow_info *info)
> >>  {
> >> +	if (info->used_shallow) {
> >> +		for (size_t i = 0; i < info->shallow->nr; i++)
> >> +			free(info->used_shallow[i]);
> >> +		free(info->used_shallow);
> >> +	}
> >> +
> >> +	free(info->need_reachability_test);
> >> +	free(info->reachable);
> >> +	free(info->shallow_ref);
> >>  	free(info->ours);
> >>  	free(info->theirs);
> >>  }
> >
> > `prepare_shallow_info()`, which allocates new memory. So would it be
> > worth to rename this function to `release_shallow_info()`?
> 
> In the longer term in a separate "renaming everything" effort, yes.
> In the context of "plug many resource leaks" series, probably no.

Yeah, agreed. And note that `release_shallow_info()` does not match our
style guide, either: it should be `shallow_info_release()`.

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