aboutsummaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2022-01-25 15:39:38 -0700
committerMartin Sebor <msebor@redhat.com>2022-01-26 10:38:23 -0700
commitc094c232eb3246154265bb035182f92fe1b17ab8 (patch)
tree4b5d30d81c1870bbda23f9d079be4509fd4d2843 /support
parente4ba8fee1a8feea62f9f06099a116163848338db (diff)
downloadglibc-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 'support')
-rw-r--r--support/tst-support-open-dev-null-range.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/support/tst-support-open-dev-null-range.c b/support/tst-support-open-dev-null-range.c
index 3ed3177..690b9d3 100644
--- a/support/tst-support-open-dev-null-range.c
+++ b/support/tst-support-open-dev-null-range.c
@@ -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");
}