On 12/5/22 07:28, Siddhesh Poyarekar wrote:
In commit e5cfb9cac1d7aba9a8ea73bfe7922cfaff9d61f3 I introduced tests
for strdup and strndup with leaks. Fix those leaks.
gcc/testsuite/ChangeLog:
* gcc.dg/builtin-dynamic-object-size-0.c (test_strdup,
test_strndup, test_strdup_min, test_strndup_min): Free RES
before returning from function.
We don't generally worry about these kinds of issues in the testsuite.
My only worry would be compromising the test. By adding the free calls
the compiler might match up the allocation and release and potentially
turn it into an alloca. I don't think we're likely to do that in this
case, but it's worth keeping in mind.
So OK as long as you've verified the test still does what it's supposed
to do.
jeff