public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Alex via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Alex <alexguo1023@gmail.com>,
	 jinyaoguo <guo846@purdue.edu>
Subject: Re: [PATCH] Allocate msg only after fatal checks to avoid leaks
Date: Fri, 13 Jun 2025 13:37:41 -0700	[thread overview]
Message-ID: <xmqqzfeb74yy.fsf@gitster.g> (raw)
In-Reply-To: <pull.1998.git.git.1749843142000.gitgitgadget@gmail.com> (Alex via GitGitGadget's message of "Fri, 13 Jun 2025 19:32:21 +0000")

"Alex via GitGitGadget" <gitgitgadget@gmail.com> 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 <guo846@purdue.edu>
    Signed-off-by: Jinyao Guo <guo846@purdue.edu>


  reply	other threads:[~2025-06-13 20:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-13 19:32 [PATCH] Allocate msg only after fatal checks to avoid leaks Alex via GitGitGadget
2025-06-13 20:37 ` Junio C Hamano [this message]
2025-06-14  8:26 ` lidongyan
2025-06-14 15:40   ` Junio C Hamano
2025-06-14 15:50     ` lidongyan
2025-06-14 23:01     ` Jeff King
2025-06-15  0:45       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqzfeb74yy.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=alexguo1023@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=guo846@purdue.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox