From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, "Elijah Newren" <newren@gmail.com>,
"Martin Ågren" <martin.agren@gmail.com>,
"Andrzej Hunt" <ajrhunt@google.com>, "Jeff King" <peff@peff.net>
Subject: Re: [PATCH v2 1/3] unpack-trees: don't leak memory in verify_clean_subdirectory()
Date: Thu, 07 Oct 2021 15:27:47 -0700 [thread overview]
Message-ID: <xmqqzgrko4gs.fsf@gitster.g> (raw)
In-Reply-To: <patch-v2-1.3-e5ef1be2aa9-20211007T094019Z-avarab@gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Thu, 7 Oct 2021 11:46:09 +0200")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> diff --git a/unpack-trees.c b/unpack-trees.c
> index a7e1712d236..89ca95ce90b 100644
> --- a/unpack-trees.c
> +++ b/unpack-trees.c
> @@ -2156,9 +2156,10 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
> if (o->dir)
> d.exclude_per_dir = o->dir->exclude_per_dir;
> i = read_directory(&d, o->src_index, pathbuf, namelen+1, NULL);
> + dir_clear(&d);
> + free(pathbuf);
> if (i)
> return add_rejected_path(o, ERROR_NOT_UPTODATE_DIR, ce->name);
> - free(pathbuf);
> return cnt;
> }
Looks trivially correct.
next prev parent reply other threads:[~2021-10-07 22:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-06 9:40 [PATCH 0/2] dir & unpak-trees: memory-leak fixes Ævar Arnfjörð Bjarmason
2021-10-06 9:40 ` [PATCH 1/2] unpack-trees: don't leak memory in verify_clean_subdirectory() Ævar Arnfjörð Bjarmason
2021-10-06 15:58 ` Elijah Newren
2021-10-06 9:40 ` [PATCH 2/2] built-ins & lib: plug memory leaks with unpack_trees_options_release() Ævar Arnfjörð Bjarmason
2021-10-06 16:12 ` Elijah Newren
2021-10-06 16:33 ` [PATCH 0/2] dir & unpak-trees: memory-leak fixes Elijah Newren
2021-10-07 9:46 ` [PATCH v2 0/3] unpack-trees: " Ævar Arnfjörð Bjarmason
2021-10-07 9:46 ` [PATCH v2 1/3] unpack-trees: don't leak memory in verify_clean_subdirectory() Ævar Arnfjörð Bjarmason
2021-10-07 22:27 ` Junio C Hamano [this message]
2021-10-07 9:46 ` [PATCH v2 2/3] sequencer: add a "goto cleanup" to do_reset() Ævar Arnfjörð Bjarmason
2021-10-07 16:06 ` Elijah Newren
2021-10-07 9:46 ` [PATCH v2 3/3] sequencer: fix a memory leak in do_reset() Ævar Arnfjörð Bjarmason
2021-10-07 16:10 ` [PATCH v2 0/3] unpack-trees: memory-leak fixes Elijah Newren
2021-10-13 13:23 ` [PATCH v3 " Ævar Arnfjörð Bjarmason
2021-10-13 13:23 ` [PATCH v3 1/3] unpack-trees: don't leak memory in verify_clean_subdirectory() Ævar Arnfjörð Bjarmason
2021-10-13 13:23 ` [PATCH v3 2/3] sequencer: add a "goto cleanup" to do_reset() Ævar Arnfjörð Bjarmason
2021-10-13 13:23 ` [PATCH v3 3/3] sequencer: fix a memory leak in do_reset() Ævar Arnfjörð Bjarmason
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=xmqqzgrko4gs.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ajrhunt@google.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=martin.agren@gmail.com \
--cc=newren@gmail.com \
--cc=peff@peff.net \
/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).