git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 13, 2025, 20:37 UTC
Message-ID
<xmqqzfeb74yy.fsf@gitster.g>
In-Reply-To
<pull.1998.git.git.1749843142000.gitgitgadget@gmail.com>
"Alex via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 13 quoted lines
> -	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 <guo846@purdue.edu>
    Signed-off-by: Jinyao Guo <guo846@purdue.edu>
Previous: Alex via GitGitGadgetNext: lidongyan
Message 2 of 7 in “Allocate msg only after fatal checks to avoid leaks”
  1. Allocate msg only after fatal checks to avoid leaksAlex via GitGitGadget, Jun 13, 2025
  2. Junio C HamanoJun 13, 2025
  3. lidongyanJun 14, 2025
  4. Junio C HamanoJun 14, 2025
  5. lidongyanJun 14, 2025
  6. Jeff KingJun 14, 2025
  7. Junio C HamanoJun 15, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.