about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--malloc/tst-interpose-aux.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index eb5b25ae02..d8990ec5a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-21  Stefan Liebler  <stli@linux.vnet.ibm.com>
+
+	* malloc/tst-interpose-aux.c (check_for_allocations):
+	Move compiler barrier before free.
+
 2017-03-20  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #21279]
diff --git a/malloc/tst-interpose-aux.c b/malloc/tst-interpose-aux.c
index e80e979299..68282b41d5 100644
--- a/malloc/tst-interpose-aux.c
+++ b/malloc/tst-interpose-aux.c
@@ -113,11 +113,11 @@ check_for_allocations (void)
     {
       /* Make sure that malloc is called at least once from libc.  */
       void *volatile ptr = strdup ("ptr");
-      free (ptr);
       /* Compiler barrier.  The strdup function calls malloc, which
          updates allocation_index, but strdup is marked __THROW, so
          the compiler could optimize away the reload.  */
       __asm__ volatile ("" ::: "memory");
+      free (ptr);
       /* If the allocation count is still zero, it means we did not
          interpose malloc successfully.  */
       if (allocation_index == 0)