]> sourceware.org Git - glibc.git/commitdiff
stdio-common: Fix memory leak in tst-freopen4* tests on UNSUPPORTED
authorFlorian Weimer <fweimer@redhat.com>
Sat, 28 Sep 2024 19:06:11 +0000 (21:06 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Sat, 28 Sep 2024 19:06:11 +0000 (21:06 +0200)
The temp_dir allocation leaks if support_can_chroot returns false.

stdio-common/tst-freopen4-main.c

index e169442cf4df2e9dadd90f441b28a4b0727e2850..7284677a97e10af6f5d599cb5c06cee951739e92 100644 (file)
@@ -33,7 +33,7 @@ int
 do_test (void)
 {
   mtrace ();
-  char *temp_dir = support_create_temp_directory ("tst-freopen4");
+  char *temp_dir;
   FILE *fp;
   int ret;
 
@@ -45,6 +45,8 @@ do_test (void)
   support_become_root ();
   if (!support_can_chroot ())
     return EXIT_UNSUPPORTED;
+
+  temp_dir = support_create_temp_directory ("tst-freopen4");
   xchroot (temp_dir);
 
   /* Test freopen with NULL, renamed file.  This verifies that
This page took 0.03962 seconds and 5 git commands to generate.