[PATCH] format-patch: mark rev_info with UNLEAK
From: Junio C Hamano <hidden>
Date: 2021-12-16 23:37:16
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted>
---
Junio C Hamano [off-list ref] writes:
> Jerry Zhang [off-list ref] 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