Re: [PATCH 06/11] branch: fix a leak in cmd_branch
On 11-jun-2023 23:46:39, Jeff King wrote:
Show 7 quoted lines
> On Sun, Jun 11, 2023 at 08:50:05PM +0200, Rubén Justo wrote:
>
> > We don't have a common clean-up section in cmd_branch(). To avoid
> > refactoring and keep the fix simple, and while we find a better
> > solution, let's silence the leak-hunter making the list static.
>
> Gross. :)
Show 18 quoted lines
>
> If we are just going to annotate here, I'd prefer to use UNLEAK(). It
> makes it more obvious this is about leak-checking, and doesn't imply
> that we otherwise care about the lifetime of this field. Like:
>
> diff --git a/builtin/branch.c b/builtin/branch.c
> index e6c2655af6..075e580d22 100644
> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -832,6 +832,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
> if (list)
> setup_auto_pager("branch", 1);
>
> + UNLEAK(sorting_options);
> +
> if (delete) {
> if (!argc)
> die(_("branch name required"));OK. Will do this.
Thank you for reviewing the change with a wide view.