malloc: Fix -Wuse-after-free warning in tst-mallocalign1 [BZ #26779]
commit3a7bed5f5a527dbd87412551f41e42e63aeef07a
authorCarlos O'Donell <carlos@redhat.com>
Fri, 28 Jan 2022 20:14:29 +0000 (28 15:14 -0500)
committerCarlos O'Donell <carlos@redhat.com>
Mon, 31 Jan 2022 05:39:28 +0000 (31 00:39 -0500)
tree3505ef8fec441d887838347602646c0f82db098a
parent4556b6edaeb706d7a86beb5b03999972bb42e764
malloc: Fix -Wuse-after-free warning in tst-mallocalign1 [BZ #26779]

The test leaks bits from the freed pointer via the return value
in ret, and the compiler correctly identifies this issue.
We switch the test to use TEST_VERIFY and terminate the test
if any of the pointers return an unexpected alignment.

This fixes another -Wuse-after-free error when compiling glibc
with gcc 12.

Tested on x86_64 and i686 without regression.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
malloc/tst-mallocalign1.c