diff options
author | Martin Sebor <msebor@redhat.com> | 2022-01-25 15:39:38 -0700 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2022-01-26 10:38:23 -0700 |
commit | c094c232eb3246154265bb035182f92fe1b17ab8 (patch) | |
tree | 4b5d30d81c1870bbda23f9d079be4509fd4d2843 /malloc/tst-malloc-check.c | |
parent | e4ba8fee1a8feea62f9f06099a116163848338db (diff) | |
download | glibc-c094c232eb3246154265bb035182f92fe1b17ab8.zip glibc-c094c232eb3246154265bb035182f92fe1b17ab8.tar.gz glibc-c094c232eb3246154265bb035182f92fe1b17ab8.tar.bz2 |
Avoid -Wuse-after-free in tests [BZ #26779].
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'malloc/tst-malloc-check.c')
-rw-r--r-- | malloc/tst-malloc-check.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/malloc/tst-malloc-check.c b/malloc/tst-malloc-check.c index 46938c0..eb46cf3 100644 --- a/malloc/tst-malloc-check.c +++ b/malloc/tst-malloc-check.c @@ -86,7 +86,15 @@ do_test (void) merror ("errno is not set correctly."); DIAG_POP_NEEDS_COMMENT; +#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 free (p); +#if __GNUC_PREREQ (12, 0) + DIAG_POP_NEEDS_COMMENT; +#endif p = malloc (512); if (p == NULL) @@ -104,7 +112,15 @@ do_test (void) merror ("errno is not set correctly."); DIAG_POP_NEEDS_COMMENT; +#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 free (p); +#if __GNUC_PREREQ (12, 0) + DIAG_POP_NEEDS_COMMENT; +#endif free (q); return errors != 0; |