From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Jerry Zhang <jerry@skydio.com>
Subject: [PATCH] format-patch: mark rev_info with UNLEAK
Date: Thu, 16 Dec 2021 15:37:10 -0800 [thread overview]
Message-ID: <xmqqpmpw6s0p.fsf_-_@gitster.g> (raw)
In-Reply-To: <xmqqee6dz5s9.fsf@gitster.g> (Junio C. Hamano's message of "Wed, 15 Dec 2021 17:40:06 -0800")
The comand uses a single instance of rev_info on stack, makes a
single revision traversal and exit. Mark the resources held by the
rev_info structure with UNLEAK().
We do not do this at lower level in revision.c or cmd_log_walk(), as
a new caller of the revision traversal API can make unbounded number
of rev_info during a single run, and UNLEAK() would not a be
suitable mechanism to deal with such a caller.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Junio C Hamano <gitster@pobox.com> writes:
> Jerry Zhang <jerry@skydio.com> writes:
>
>> t/t4126-apply-empty.sh | 22 ++++++++++++++++++----
>> 4 files changed, 30 insertions(+), 7 deletions(-)
>> ...
>> diff --git a/t/t4126-apply-empty.sh b/t/t4126-apply-empty.sh
>> index ceb6a79fe0..949e284d14 100755
>> --- a/t/t4126-apply-empty.sh
>> +++ b/t/t4126-apply-empty.sh
>> @@ -7,10 +7,12 @@ test_description='apply empty'
>> test_expect_success setup '
>> >empty &&
>> git add empty &&
>> test_tick &&
>> git commit -m initial &&
>> + git commit --allow-empty -m "empty commit" &&
>> + git format-patch --always HEAD~ >empty.patch &&
>> for i in a b c d e
>
> When merged with anything that has ab/mark-leak-free-tests-even-more
> topic, this will start breaking the tests, as it is my understanding
> that "git log" family hasn't been audited and converted for leak
> sanitizer.
> ...
> I am tempted to drop the "TEST_PASSES" bit from this script for now,
> but I have to say that the "mark leak-free tests" topic took us in
> an awkward place. We probably want to do something a bit more fine
> grained about it.
Luckily, this test script is small enough that format-patch is the
only new offender, it seems, and with the attached patch I plan to
queue on a separate topic merged, it seem it no longer upsets the
sanitizer.
builtin/log.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/builtin/log.c b/builtin/log.c
index f75d87e8d7..a7bca8353b 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -2241,6 +2241,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
strbuf_release(&rdiff1);
strbuf_release(&rdiff2);
strbuf_release(&rdiff_title);
+ UNLEAK(rev);
return 0;
}
--
2.34.1-472-g213ab46be7
next prev parent reply other threads:[~2021-12-16 23:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 22:03 [PATCH V3 1/2] git-apply: add --quiet flag Jerry Zhang
2021-12-13 22:03 ` [PATCH V5 2/2] git-apply: add --allow-empty flag Jerry Zhang
2021-12-16 1:40 ` Junio C Hamano
2021-12-16 23:11 ` [PATCH] t4204 is not sanitizer clean at all Junio C Hamano
2021-12-17 4:39 ` Ævar Arnfjörð Bjarmason
2021-12-17 20:48 ` Junio C Hamano
2021-12-17 22:23 ` Ævar Arnfjörð Bjarmason
2021-12-16 23:37 ` Junio C Hamano [this message]
2021-12-17 4:51 ` [PATCH V5 2/2] git-apply: add --allow-empty flag Ævar Arnfjörð Bjarmason
2021-12-17 20:48 ` Junio C Hamano
2021-12-17 22:28 ` Ævar Arnfjörð Bjarmason
2021-12-17 22:32 ` Junio C Hamano
2021-12-13 22:30 ` [PATCH V3 1/2] git-apply: add --quiet flag 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=xmqqpmpw6s0p.fsf_-_@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=jerry@skydio.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).