mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
Avoid -Wuse-after-free in tests [BZ #26779].
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
@ -138,8 +138,16 @@ do_test (void)
|
||||
if (ok == 0)
|
||||
merror ("first 16 bytes were not correct after failed realloc");
|
||||
|
||||
#if __GNUC_PREREQ (12, 0)
|
||||
/* Ignore a valid warning about using a pointer made indeterminate
|
||||
by a prior call to realloc(). */
|
||||
DIAG_IGNORE_NEEDS_COMMENT (12, "-Wuse-after-free");
|
||||
#endif
|
||||
/* realloc (p, 0) frees p (C89) and returns NULL (glibc). */
|
||||
p = realloc (p, 0);
|
||||
#if __GNUC_PREREQ (12, 0)
|
||||
DIAG_POP_NEEDS_COMMENT;
|
||||
#endif
|
||||
if (p != NULL)
|
||||
merror ("realloc (p, 0) returned non-NULL.");
|
||||
|
||||
|
Reference in New Issue
Block a user