aboutsummaryrefslogtreecommitdiff
path: root/malloc/mtrace.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-06-17 09:36:54 +0000
committerUlrich Drepper <drepper@redhat.com>1999-06-17 09:36:54 +0000
commit92e4472f1fe087c1d2c239b3de7f7348d1a5c933 (patch)
tree8270e8c4651bb15f5b669a0d6fe71811f038f4c1 /malloc/mtrace.c
parent0013b2b1dfeaee971eec0d0d16598166229d856b (diff)
downloadglibc-92e4472f1fe087c1d2c239b3de7f7348d1a5c933.zip
glibc-92e4472f1fe087c1d2c239b3de7f7348d1a5c933.tar.gz
glibc-92e4472f1fe087c1d2c239b3de7f7348d1a5c933.tar.bz2
Update.
1999-06-17 Andreas Jaeger <aj@arthur.rhein-neckar.de> * elf/dl-load.c (_dl_init_paths): Add one more element to aelem to not write beyond allocated memory. Reported by John Reiser <jreiser@BitWagon.com>, closes PR libc/1167. 1999-06-17 Ulrich Drepper <drepper@cygnus.com> * malloc/mtrace.c: Keep lock while printing output lines. Patch by carsten.zimmermann@mediaways.net [PR libc/1166].
Diffstat (limited to 'malloc/mtrace.c')
-rw-r--r--malloc/mtrace.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index 6af064c..c539cb4 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -127,9 +127,11 @@ tr_freehook (ptr, caller)
__ptr_t ptr;
const __ptr_t caller;
{
+ __libc_lock_lock (lock);
tr_where (caller);
/* Be sure to print it first. */
fprintf (mallstream, "- %p\n", ptr);
+ __libc_lock_unlock (lock);
if (ptr == mallwatch)
tr_break ();
__libc_lock_lock (lock);
@@ -159,12 +161,12 @@ tr_mallochook (size, caller)
hdr = (__ptr_t) malloc (size);
__malloc_hook = tr_mallochook;
- __libc_lock_unlock (lock);
-
tr_where (caller);
/* We could be printing a NULL here; that's OK. */
fprintf (mallstream, "+ %p %#lx\n", hdr, (unsigned long int) size);
+ __libc_lock_unlock (lock);
+
if (hdr == mallwatch)
tr_break ();
@@ -196,8 +198,6 @@ tr_reallochook (ptr, size, caller)
__malloc_hook = tr_mallochook;
__realloc_hook = tr_reallochook;
- __libc_lock_unlock (lock);
-
tr_where (caller);
if (hdr == NULL)
/* Failed realloc. */
@@ -211,6 +211,8 @@ tr_reallochook (ptr, size, caller)
fprintf (mallstream, "> %p %#lx\n", hdr, (unsigned long int) size);
}
+ __libc_lock_unlock (lock);
+
if (hdr == mallwatch)
tr_break ();