Subject: Re: [PATCH] Allocate msg only after fatal checks to avoid leaks

From: Junio C Hamano <[email-masked]>
Date: Fri, 13 Jun 2025 13:37:41 -0700

"Alex via GitGitGadget" <[email-masked]> writes:

> -	if (type != OBJ_BLOB) {
> -		strbuf_release(&msg->buf);
> -		free(value);
> -		free(msg);
> -		die(_("cannot read note data from non-blob object '%s'."), arg);
> -	}
> +    if (type != OBJ_BLOB) {
> +        free(value);
> +        die(_("cannot read note data from non-blob object '%s'."), arg);
> +    }
> +
> +    msg = xmalloc(sizeof(*msg));
> +    strbuf_init(&msg->buf, 0);

ALl the new lines seem to be indented by four spaces.  Check with
Documantation/CodingGuidelines.

Also, Documantation/SubmittingPatches::[[real-name]] asks folks to
use their real name as authorname.  You prefer your purdue
address, that is fine, but let's do something like

    From: Jinyao Guo <[email-masked]>
    Signed-off-by: Jinyao Guo <[email-masked]>