From 7c11c4a14684f23babd5060931529f095b8f81d3 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 4 Aug 2004 21:58:10 +0000 Subject: (do_release_all): Add __libc_freeres_fn_section. --- iconv/gconv_db.c | 9 +++++++-- iconv/gconv_dl.c | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'iconv') diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c index a21f8dd..719ff95 100644 --- a/iconv/gconv_db.c +++ b/iconv/gconv_db.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -170,7 +171,7 @@ add_derivation (const char *fromset, const char *toset, not all memory will be freed. */ } -static void +static void __libc_freeres_fn_section free_derivation (void *p) { struct known_derivation *deriv = (struct known_derivation *) p; @@ -765,7 +766,7 @@ __gconv_close_transform (struct __gconv_step *steps, size_t nsteps) /* Free the modules mentioned. */ static void -internal_function +internal_function __libc_freeres_fn_section free_modules_db (struct gconv_module *node) { if (node->left != NULL) @@ -786,6 +787,10 @@ free_modules_db (struct gconv_module *node) /* Free all resources if necessary. */ libc_freeres_fn (free_mem) { + /* First free locale memory. This needs to be done before freeing derivations, + as ctype cleanup functions dereference steps arrays which we free below. */ + _nl_locale_subfreeres (); + if (__gconv_alias_db != NULL) __tdestroy (__gconv_alias_db, free); diff --git a/iconv/gconv_dl.c b/iconv/gconv_dl.c index cc7627a..9504017 100644 --- a/iconv/gconv_dl.c +++ b/iconv/gconv_dl.c @@ -1,5 +1,6 @@ /* Handle loading/unloading of shared object for transformation. - Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -191,7 +192,7 @@ __gconv_release_shlib (struct __gconv_loaded_object *handle) /* We run this if we debug the memory allocation. */ -static void +static void __libc_freeres_fn_section do_release_all (void *nodep) { struct __gconv_loaded_object *obj = (struct __gconv_loaded_object *) nodep; -- cgit v1.1