This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.28.9000-237-g6070803


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  60708030536df82616c16aa2f14f533c4362b969 (commit)
       via  a91e9301c47bb688f4e496a19cfc68261ff18293 (commit)
       via  07da99aad93c9364acb7efdab47c27ba698f6313 (commit)
      from  f5e7e95921847bd83186bfe621fc2b48c4de5477 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=60708030536df82616c16aa2f14f533c4362b969

commit 60708030536df82616c16aa2f14f533c4362b969
Author: Florian Weimer <fweimer@redhat.com>
Date:   Tue Oct 30 13:56:40 2018 +0100

    stdlib/test-bz22786: Avoid memory leaks in the test itself

diff --git a/ChangeLog b/ChangeLog
index eefe1ce..1649229 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2018-10-30  Florian Weimer  <fweimer@redhat.com>
 
+	* stdlib/test-bz22786.c (do_test): Additional free calls to avoid
+	memory leaks.
+
+2018-10-30  Florian Weimer  <fweimer@redhat.com>
+
 	* support/blob_repeat.c (allocate_big): Call mkstemp directly.
 
 2018-10-30  Florian Weimer  <fweimer@redhat.com>
diff --git a/stdlib/test-bz22786.c b/stdlib/test-bz22786.c
index bb1e04f..8035e8a 100644
--- a/stdlib/test-bz22786.c
+++ b/stdlib/test-bz22786.c
@@ -36,8 +36,8 @@
 static int
 do_test (void)
 {
-  const char *dir = support_create_temp_directory ("bz22786.");
-  const char *lnk = xasprintf ("%s/symlink", dir);
+  char *dir = support_create_temp_directory ("bz22786.");
+  char *lnk = xasprintf ("%s/symlink", dir);
   const size_t path_len = (size_t) INT_MAX + strlen (lnk) + 1;
 
   struct support_blob_repeat repeat
@@ -72,6 +72,8 @@ do_test (void)
   /* Cleanup.  */
   unlink (lnk);
   support_blob_repeat_free (&repeat);
+  free (lnk);
+  free (dir);
 
   return 0;
 }

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a91e9301c47bb688f4e496a19cfc68261ff18293

commit a91e9301c47bb688f4e496a19cfc68261ff18293
Author: Florian Weimer <fweimer@redhat.com>
Date:   Tue Oct 30 13:55:50 2018 +0100

    support_blob_repeat: Call mkstemp directory for the backing file
    
    This avoids a warning during post-test cleanup.

diff --git a/ChangeLog b/ChangeLog
index 734defa..eefe1ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2018-10-30  Florian Weimer  <fweimer@redhat.com>
 
+	* support/blob_repeat.c (allocate_big): Call mkstemp directly.
+
+2018-10-30  Florian Weimer  <fweimer@redhat.com>
+
 	* stdlib/tst-strtod-overflow.c (do_test): Switch to
 	support_blob_repeat.
 
diff --git a/support/blob_repeat.c b/support/blob_repeat.c
index da4ca83..16c1e44 100644
--- a/support/blob_repeat.c
+++ b/support/blob_repeat.c
@@ -23,8 +23,8 @@
 #include <string.h>
 #include <support/blob_repeat.h>
 #include <support/check.h>
+#include <support/test-driver.h>
 #include <support/support.h>
-#include <support/temp_file.h>
 #include <support/xunistd.h>
 #include <sys/mman.h>
 #include <unistd.h>
@@ -155,13 +155,17 @@ allocate_big (size_t total_size, const void *element, size_t element_size,
   if (target == MAP_FAILED)
     return (struct support_blob_repeat) { 0 };
 
-  /* Create the backing file for the repeated mapping.  */
+  /* Create the backing file for the repeated mapping.  Call mkstemp
+     directly to remove the resources backing the temporary file
+     immediately, once support_blob_repeat_free is called.  Using
+     create_temp_file would result in a warning during post-test
+     cleanup.  */
   int fd;
   {
-    char *temppath;
-    fd = create_temp_file ("support_blob_repeat-", &temppath);
+    char *temppath = xasprintf ("%s/support_blob_repeat-XXXXXX", test_dir);
+    fd = mkstemp (temppath);
     if (fd < 0)
-      FAIL_EXIT1 ("create_temp_file: %m");
+      FAIL_EXIT1 ("mkstemp (\"%s\"): %m", temppath);
     xunlink (temppath);
     free (temppath);
   }

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=07da99aad93c9364acb7efdab47c27ba698f6313

commit 07da99aad93c9364acb7efdab47c27ba698f6313
Author: Florian Weimer <fweimer@redhat.com>
Date:   Tue Oct 30 13:55:01 2018 +0100

    stdlib/tst-strtod-overflow: Switch to support_blob_repeat
    
    This is another test with an avoidable large memory allocation.

diff --git a/ChangeLog b/ChangeLog
index a9e1713..734defa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2018-10-30  Florian Weimer  <fweimer@redhat.com>
 
+	* stdlib/tst-strtod-overflow.c (do_test): Switch to
+	support_blob_repeat.
+
+2018-10-30  Florian Weimer  <fweimer@redhat.com>
+
 	Avoid spurious test failures in stdlib/test-bz22786.
 	* support/Makefile (libsupport-routines): Add blob_repeat.
 	(tests): Add tst-support_blob_repeat.
diff --git a/stdlib/tst-strtod-overflow.c b/stdlib/tst-strtod-overflow.c
index d14638d..dc53c1e 100644
--- a/stdlib/tst-strtod-overflow.c
+++ b/stdlib/tst-strtod-overflow.c
@@ -19,6 +19,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <support/blob_repeat.h>
+#include <support/test-driver.h>
 
 #define EXPONENT "e-2147483649"
 #define SIZE 214748364
@@ -26,21 +28,23 @@
 static int
 do_test (void)
 {
-  char *p = malloc (1 + SIZE + sizeof (EXPONENT));
-  if (p == NULL)
+  struct support_blob_repeat repeat = support_blob_repeat_allocate
+    ("0", 1, 1 + SIZE + sizeof (EXPONENT));
+  if (repeat.size == 0)
     {
-      puts ("malloc failed, cannot test for overflow");
-      return 0;
+      puts ("warning: memory allocation failed, cannot test for overflow");
+      return EXIT_UNSUPPORTED;
     }
+  char *p = repeat.start;
   p[0] = '1';
-  memset (p + 1, '0', SIZE);
   memcpy (p + 1 + SIZE, EXPONENT, sizeof (EXPONENT));
   double d = strtod (p, NULL);
   if (d != 0)
     {
-      printf ("strtod returned wrong value: %a\n", d);
+      printf ("error: strtod returned wrong value: %a\n", d);
       return 1;
     }
+  support_blob_repeat_free (&repeat);
   return 0;
 }
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                    |   14 ++++++++++++++
 stdlib/test-bz22786.c        |    6 ++++--
 stdlib/tst-strtod-overflow.c |   16 ++++++++++------
 support/blob_repeat.c        |   14 +++++++++-----
 4 files changed, 37 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]