Fix mtrace stack overflow bug
authorDavid Bartley <dtbartle@glibc.(none)>
Tue, 3 Feb 2009 02:24:25 +0000 (02:24 +0000)
committerDavid Bartley <dtbartle@glibc.(none)>
Tue, 3 Feb 2009 02:24:25 +0000 (02:24 +0000)
malloc/mtrace.c

index 1a9522b..5441579 100644 (file)
@@ -358,11 +358,11 @@ muntrace ()
   if (mallstream == NULL)
     return;
 
-  fprintf (mallstream, "= End\n");
-  fclose (mallstream);
-  mallstream = NULL;
   __free_hook = tr_old_free_hook;
   __malloc_hook = tr_old_malloc_hook;
   __realloc_hook = tr_old_realloc_hook;
   __memalign_hook = tr_old_memalign_hook;
+  fprintf (mallstream, "= End\n");
+  fclose (mallstream);
+  mallstream = NULL;
 }