about summary refs log tree commit diff
path: root/malloc
diff options
context:
space:
mode:
Diffstat (limited to 'malloc')
-rw-r--r--malloc/set-freeres.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/malloc/set-freeres.c b/malloc/set-freeres.c
index 1724070704..d836d0c1bf 100644
--- a/malloc/set-freeres.c
+++ b/malloc/set-freeres.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,6 +21,10 @@
 #include <set-hooks.h>
 #include <libc-internal.h>
 
+#ifdef USE_IN_LIBIO
+# include "../libio/libioP.h"
+#endif
+
 DEFINE_HOOK (__libc_subfreeres, (void));
 
 void
@@ -31,5 +35,11 @@ __libc_freeres (void)
   static long int already_called;
 
   if (compare_and_swap (&already_called, 0, 1))
-    RUN_HOOK (__libc_subfreeres, ());
+    {
+#ifdef USE_IN_LIBIO
+      _IO_cleanup ();
+#endif
+
+      RUN_HOOK (__libc_subfreeres, ());
+    }
 }