1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00

Avoid -Wuse-after-free in tests [BZ #26779].

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Martin Sebor
2022-01-25 15:39:38 -07:00
parent e4ba8fee1a
commit c094c232eb
6 changed files with 60 additions and 2 deletions

View File

@@ -39,10 +39,11 @@ check_path (int fd)
char file_path[PATH_MAX];
ssize_t file_path_length
= readlink (proc_fd_path, file_path, sizeof (file_path));
free (proc_fd_path);
if (file_path_length < 0)
FAIL_EXIT1 ("readlink (%s, %p, %zu)", proc_fd_path, file_path,
sizeof (file_path));
free (proc_fd_path);
file_path[file_path_length] = '\0';
TEST_COMPARE_STRING (file_path, "/dev/null");
}