git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Subject: [PATCH 0/6] apply: fix leaking buffer of `struct image`
Date: Mon, 16 Sep 2024 09:09:58 +0200	[thread overview]
Message-ID: <cover.1726470385.git.ps@pks.im> (raw)

Hi,

this patch series addresses memory leaks in "apply.c" revolving around
`struct image`. I've split the series out of the usual leak fix series
because I found the code really hard to reason about. So instead of just
trying to plug the leak with a least-effort patch I refactored it a bit
to make it more straight-forward. Most importantly, the last patch
converts the code to use a proper `struct strbuf` to modify the pre- and
postimages, which is both easier and allows for proper lifecycle
management of its buffer.

This series builds on top of ed155187b4 (Sync with Git 2.46.1,
2024-09-13).

Thanks!

Patrick

Patrick Steinhardt (6):
  apply: reorder functions to move image-related things together
  apply: rename functions operating on `struct image`
  apply: introduce macro and function to init images
  apply: refactor code to drop `line_allocated`
  apply: rename members that track line count and allocation length
  apply: refactor `struct image` to use a `struct strbuf`

 apply.c                            | 447 +++++++++++++----------------
 t/t3436-rebase-more-options.sh     |   1 +
 t/t4107-apply-ignore-whitespace.sh |   4 +-
 t/t4124-apply-ws-rule.sh           |   1 +
 t/t4125-apply-ws-fuzz.sh           |   1 +
 t/t4138-apply-ws-expansion.sh      |   1 +
 6 files changed, 204 insertions(+), 251 deletions(-)

-- 
2.46.0.551.gc5ee8f2d1c.dirty


             reply	other threads:[~2024-09-16  7:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-16  7:09 Patrick Steinhardt [this message]
2024-09-16  7:10 ` [PATCH 1/6] apply: reorder functions to move image-related things together Patrick Steinhardt
2024-09-16  7:10 ` [PATCH 2/6] apply: rename functions operating on `struct image` Patrick Steinhardt
2024-09-16  7:10 ` [PATCH 3/6] apply: introduce macro and function to init images Patrick Steinhardt
2024-09-16  7:10 ` [PATCH 4/6] apply: refactor code to drop `line_allocated` Patrick Steinhardt
2024-09-16 18:56   ` Junio C Hamano
2024-09-17  9:50     ` Patrick Steinhardt
2024-09-16 21:40   ` Junio C Hamano
2024-09-16  7:10 ` [PATCH 5/6] apply: rename members that track line count and allocation length Patrick Steinhardt
2024-09-16  7:10 ` [PATCH 6/6] apply: refactor `struct image` to use a `struct strbuf` Patrick Steinhardt
2024-09-16 19:30   ` Junio C Hamano
2024-09-17 10:07 ` [PATCH v2 0/6] apply: fix leaking buffer of `struct image` Patrick Steinhardt
2024-09-17 10:07   ` [PATCH v2 1/6] apply: reorder functions to move image-related things together Patrick Steinhardt
2024-09-17 10:07   ` [PATCH v2 2/6] apply: rename functions operating on `struct image` Patrick Steinhardt
2024-09-17 10:08   ` [PATCH v2 3/6] apply: introduce macro and function to init images Patrick Steinhardt
2024-09-17 10:08   ` [PATCH v2 4/6] apply: refactor code to drop `line_allocated` Patrick Steinhardt
2024-09-17 10:08   ` [PATCH v2 5/6] apply: rename members that track line count and allocation length Patrick Steinhardt
2024-09-17 10:08   ` [PATCH v2 6/6] apply: refactor `struct image` to use a `struct strbuf` Patrick Steinhardt
2024-09-17 10:08   ` [PATCH v2 0/6] apply: fix leaking buffer of `struct image` Patrick Steinhardt
2024-09-17 20:57   ` 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=cover.1726470385.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).