From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH] range-diff: support reading mbox files
Date: Fri, 18 Nov 2022 12:39:02 +0100 (CET) [thread overview]
Message-ID: <6590112p-1n6o-4413-n805-0pp6o9r1r3sn@tzk.qr> (raw)
In-Reply-To: <221117.86leo9h20m.gmgdl@evledraar.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]
Hi Ævar,
On Thu, 17 Nov 2022, Ævar Arnfjörð Bjarmason wrote:
>
> On Tue, Nov 15 2022, Johannes Schindelin via GitGitGadget wrote:
>
> > + if (starts_with(line, "diff --git ")) {
> > + struct patch patch = { 0 };
> > + struct strbuf root = STRBUF_INIT;
> > + int linenr = 0;
> > + int orig_len;
> > +
> > + state = MBOX_IN_DIFF;
> > + old_count = new_count = 0;
> > + strbuf_addch(&buf, '\n');
> > + if (!util->diff_offset)
> > + util->diff_offset = buf.len;
> > + line[len - 1] = '\n';
> > + orig_len = len;
> > + len = parse_git_diff_header(&root, &linenr, 1, line,
> > + len, size, &patch);
>
> Try this with SANITIZE=leak, e.g. this seems to fix 1/4 leaks that pop
> up if you try the command noted in the patch:
>
> diff --git a/range-diff.c b/range-diff.c
> index 77fa9b970b1..7ff33f92e39 100644
> --- a/range-diff.c
> +++ b/range-diff.c
> @@ -142,6 +142,7 @@ static int read_mbox(const char *path, struct string_list *list)
> orig_len = len;
> len = parse_git_diff_header(&root, &linenr, 1, line,
> len, size, &patch);
> + free(patch.def_name);
> if (len < 0) {
> error(_("could not parse git header '%.*s'"),
> orig_len, line);
Thank you for keeping your feedback concise. Much appreciated.
This will be addressed in the next iteration,
Johannes
next prev parent reply other threads:[~2022-11-18 11:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 18:20 [PATCH] range-diff: support reading mbox files Johannes Schindelin via GitGitGadget
2022-11-16 2:09 ` Taylor Blau
2022-11-16 14:40 ` Phillip Wood
2022-11-17 10:26 ` Phillip Wood
2022-11-18 12:53 ` Johannes Schindelin
2022-11-18 13:16 ` Johannes Schindelin
2022-11-17 18:24 ` Ævar Arnfjörð Bjarmason
2022-11-18 11:39 ` Johannes Schindelin [this message]
2022-11-19 23:11 ` [PATCH v2] " Johannes Schindelin via GitGitGadget
2022-11-21 10:08 ` Phillip Wood
2022-11-22 7:40 ` Johannes Schindelin
2022-11-22 14:20 ` Phillip Wood
2022-11-22 9:08 ` [PATCH v3] " Johannes Schindelin via GitGitGadget
2022-11-22 14:23 ` Phillip Wood
2022-11-22 23:58 ` Junio C Hamano
2023-03-03 22:02 ` 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=6590112p-1n6o-4413-n805-0pp6o9r1r3sn@tzk.qr \
--to=johannes.schindelin@gmx.de \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
/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).