about summary refs log tree commit diff
path: root/malloc
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-12-22 11:38:32 -0500
committerUlrich Drepper <drepper@gmail.com>2011-12-22 11:38:32 -0500
commit41043168619f1bcb12a718792b052703b9d69e91 (patch)
tree6294b149f293472d4a91b50f4d4451c6bd59d70a /malloc
parentb7763303bfe01853eb4b5d034414e445e8c6a7b5 (diff)
downloadglibc-41043168619f1bcb12a718792b052703b9d69e91.tar.gz
glibc-41043168619f1bcb12a718792b052703b9d69e91.tar.xz
glibc-41043168619f1bcb12a718792b052703b9d69e91.zip
Optimize tr_freehook
Diffstat (limited to 'malloc')
-rw-r--r--malloc/mtrace.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index b55449f1ea..0d0cb35ff3 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -146,10 +146,12 @@ tr_freehook (ptr, caller)
   tr_where (caller, info);
   /* Be sure to print it first.  */
   fprintf (mallstream, "- %p\n", ptr);
-  __libc_lock_unlock (lock);
   if (ptr == mallwatch)
-    tr_break ();
-  __libc_lock_lock (lock);
+    {
+      __libc_lock_unlock (lock);
+      tr_break ();
+      __libc_lock_lock (lock);
+    }
   __free_hook = tr_old_free_hook;
   if (tr_old_free_hook != NULL)
     (*tr_old_free_hook) (ptr, caller);