git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Rubén Justo" <rjusto@gmail.com>
To: phillip.wood@dunelm.org.uk
Cc: Junio C Hamano <gitster@pobox.com>, Git List <git@vger.kernel.org>
Subject: Re: [PATCH 1/4] apply: plug a leak in apply_data
Date: Tue, 23 Apr 2024 00:04:16 +0200	[thread overview]
Message-ID: <78f38e0f-7456-42d7-b0d1-887944bb01c9@gmail.com> (raw)
In-Reply-To: <74a6465c-01b6-4a65-8491-751244d37c82@gmail.com>

On Mon, Apr 22, 2024 at 04:41:18PM +0100, Phillip Wood wrote:

> On 21/04/2024 11:28, Rubén Justo wrote:
> > Plug a leak we have since cfb6f9acc3 (apply: accept -3/--3way command
> > line option, 2012-05-08).
> 
> Looking at that commit I see
> 
> -        if (apply_fragments(&image, patch) < 0)
> -                return -1; /* note with --reject this succeeds. */
> +        if (apply_fragments(&image, patch) < 0) {
> +                /* Note: with --reject, apply_fragments() returns 0 */
> +                if (!threeway || try_threeway(&image, patch, st, ce) < 0)
> +                        return -1;
> +        }
> 
> So the leak existed before that commit. Indeed it looks
> like the leak predates the introduction of struct image in b94f2eda99
> (builtin-apply.c: make it more line oriented, 2008-01-26) and when
> the patch does not apply we have been leaking the buffer passed to
> apply_fragments() since the beginning of the builtin apply added in
> ac6245e31a3 (Builtin git-apply., 2006-05-23)

You are very right.

I saw that commit.  I reviewed again my notes and I recorded the hash of
the previous hop;  the one that my message, incorrectly, refers to.
I'll reroll to fix it.

Thank you very much for your attention.


  reply	other threads:[~2024-04-22 22:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-21 10:22 [PATCH 0/4] mark t3701-add-interactive.sh as leak-free Rubén Justo
2024-04-21 10:27 ` [PATCH 2/4] add-interactive: plug a leak in get_untracked_files Rubén Justo
2024-04-22 15:50   ` Junio C Hamano
2024-04-21 10:28 ` [PATCH 1/4] apply: plug a leak in apply_data Rubén Justo
2024-04-22 15:41   ` Phillip Wood
2024-04-22 22:04     ` Rubén Justo [this message]
2024-04-22 22:27       ` Junio C Hamano
2024-04-21 10:28 ` [PATCH 3/4] add-patch: plug a leak handling the '/' command Rubén Justo
2024-04-21 10:29 ` [PATCH 4/4] add: plug a leak on interactive_add Rubén Justo
2024-04-22 15:43   ` Phillip Wood
2024-04-22 23:04     ` Rubén Justo
2024-04-22  6:06 ` [PATCH 0/4] mark t3701-add-interactive.sh as leak-free Patrick Steinhardt
2024-04-22 15:30 ` Junio C Hamano
2024-04-22 22:51 ` [PATCH v2 " Rubén Justo
2024-04-22 22:54   ` [PATCH v2 1/4] apply: plug a leak in apply_data Rubén Justo
2024-04-22 22:54   ` [PATCH v2 2/4] add-interactive: plug a leak in get_untracked_files Rubén Justo
2024-04-22 22:54   ` [PATCH v2 3/4] add-patch: plug a leak handling the '/' command Rubén Justo
2024-04-22 22:54   ` [PATCH v2 4/4] add: plug a leak on interactive_add Rubén Justo
2024-04-22 23:26   ` [PATCH v2 0/4] mark t3701-add-interactive.sh as leak-free 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=78f38e0f-7456-42d7-b0d1-887944bb01c9@gmail.com \
    --to=rjusto@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).