summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2018-10-30 13:56:40 +0100
committerAndreas K. Hüttel <dilfridge@gentoo.org>2018-12-11 23:29:59 +0100
commit5699c4e822ea5d353230d8446017eda54fbdc2c8 (patch)
tree39b3d716c38cc3ba698badb1b6458e99e3cdd72f
parentstdlib/test-bz22786: Avoid spurious test failures using alias mappings (diff)
downloadglibc-5699c4e822ea5d353230d8446017eda54fbdc2c8.tar.gz
glibc-5699c4e822ea5d353230d8446017eda54fbdc2c8.tar.bz2
glibc-5699c4e822ea5d353230d8446017eda54fbdc2c8.zip
stdlib/test-bz22786: Avoid memory leaks in the test itself
(cherry picked from commit 60708030536df82616c16aa2f14f533c4362b969) (cherry picked from commit 69dcd992a0efdb53bc2ea4948cfc6b13416b9636) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
-rw-r--r--ChangeLog5
-rw-r--r--stdlib/test-bz22786.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2043b21dde..a2a9fc3cc9 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>
+
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/test-bz22786.c b/stdlib/test-bz22786.c
index bb1e04f2de..8035e8a394 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;
}