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.26-227-g24cffce


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  24cffce7366c4070d8f823702a4fcec2cb732595 (commit)
      from  ecd0747df388f3925d4839740b0abcf43d0a9fb2 (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=24cffce7366c4070d8f823702a4fcec2cb732595

commit 24cffce7366c4070d8f823702a4fcec2cb732595
Author: Florian Weimer <fweimer@redhat.com>
Date:   Thu Aug 31 14:55:11 2017 +0200

    malloc: Resolve compilation failure in NDEBUG mode
    
    In _int_free, the locked variable is not used if NDEBUG is defined.

diff --git a/ChangeLog b/ChangeLog
index ce8cb73..79953a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-08-31  Florian Weimer  <fweimer@redhat.com>
+
+	* malloc/malloc.c (_int_free): Remove locked variable and related
+	asserts.
+
 2017-08-31  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #22051]
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 768670c..e1159a5 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4106,8 +4106,6 @@ _int_free (mstate av, mchunkptr p, int have_lock)
   mchunkptr bck;               /* misc temp for linking */
   mchunkptr fwd;               /* misc temp for linking */
 
-  int locked = 0;
-
   size = chunksize (p);
 
   /* Little security check which won't hurt performance: the
@@ -4162,19 +4160,14 @@ _int_free (mstate av, mchunkptr p, int have_lock)
 	/* We might not have a lock at this point and concurrent modifications
 	   of system_mem might have let to a false positive.  Redo the test
 	   after getting the lock.  */
-	if (have_lock
-	    || ({ assert (locked == 0);
-		  __libc_lock_lock (av->mutex);
-		  locked = 1;
+	if (!have_lock
+	    || ({ __libc_lock_lock (av->mutex);
 		  chunksize_nomask (chunk_at_offset (p, size)) <= 2 * SIZE_SZ
-		    || chunksize (chunk_at_offset (p, size)) >= av->system_mem;
-	      }))
+		  || chunksize (chunk_at_offset (p, size)) >= av->system_mem;
+	        }))
 	  malloc_printerr ("free(): invalid next size (fast)");
 	if (! have_lock)
-	  {
-	    __libc_lock_unlock (av->mutex);
-	    locked = 0;
-	  }
+	  __libc_lock_unlock (av->mutex);
       }
 
     free_perturb (chunk2mem(p), size - 2 * SIZE_SZ);
@@ -4211,10 +4204,8 @@ _int_free (mstate av, mchunkptr p, int have_lock)
   */
 
   else if (!chunk_is_mmapped(p)) {
-    if (! have_lock) {
+    if (!have_lock)
       __libc_lock_lock (av->mutex);
-      locked = 1;
-    }
 
     nextchunk = chunk_at_offset(p, size);
 
@@ -4328,10 +4319,8 @@ _int_free (mstate av, mchunkptr p, int have_lock)
       }
     }
 
-    if (! have_lock) {
-      assert (locked);
+    if (!have_lock)
       __libc_lock_unlock (av->mutex);
-    }
   }
   /*
     If the chunk was allocated via mmap, release via munmap().

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

Summary of changes:
 ChangeLog       |    5 +++++
 malloc/malloc.c |   25 +++++++------------------
 2 files changed, 12 insertions(+), 18 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]