From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30829 invoked by alias); 6 Aug 2004 09:35:14 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 30807 invoked from network); 6 Aug 2004 09:35:12 -0000 Received: from unknown (HELO sunsite.ms.mff.cuni.cz) (195.113.15.26) by sourceware.org with SMTP; 6 Aug 2004 09:35:12 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8) with ESMTP id i767IT3j026376; Fri, 6 Aug 2004 09:18:29 +0200 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id i767ITt6026372; Fri, 6 Aug 2004 09:18:29 +0200 Date: Fri, 06 Aug 2004 09:35:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] One more fix for valgrind discovered problems Message-ID: <20040806071829.GI30497@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2004-08/txt/msg00013.txt.bz2 Hi! _nl_unload_domain called from finddomain.c's free_mem needs steps arrays not freed yet as well. I have checked that -static program referencing __gconv_find_transform and nothing else in main () sucks in both setlocale.o and finddomain.o, so this and the previous patch shouldn't be a regression for size of statically linked programs (if this was not the case, we could play tricks with weak symbols etc.). With this patch in as well as the mbsrtowcs fix from yesterday all valgrind --tool=memcheck complains I see (and aren't suppressed) are either false alarms (e.g. nasty warnings about regcomp.c which tests if (dfa->nodes[node].type == CHARACTER && dfa->nodes[node].mb_partial) but mb_partial is only initialized if type == CHARACTER; as both are bitfields, GCC optimizes the test into (x & 0x1000ff) == 0x100001 and valgrind doesn't like that the test sees an unitialized bit) or tests which link against -lpthread (where I expect them not to work, as valgrind has its own libpthread). 2004-08-06 Jakub Jelinek * intl/finddomain.c (free_mem): Rename to... (_nl_finddomain_subfreeres): ... this. Add __libc_freeres_fn_section. * intl/loadmsgcat.c (_nl_unload_domain): Add __libc_freeres_fn_section. * intl/gettextP.h (_nl_unload_domain): Move into #ifdef _LIBC. Add attribute_hidden. (_nl_findomain_subfreeres): New prototype. * iconv/gconv_db.c (free_mem): Call _nl_findomain_subfreeres. --- libc/intl/finddomain.c.jj 2002-11-01 21:43:55.000000000 +0100 +++ libc/intl/finddomain.c 2004-08-05 18:17:46.000000000 +0200 @@ -1,5 +1,6 @@ /* Handle list of needed message catalogs - Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000, 2001, 2002, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper , 1995. @@ -168,7 +169,10 @@ _nl_find_domain (dirname, locale, domain #ifdef _LIBC -libc_freeres_fn (free_mem) +/* This is called from iconv/gconv_db.c's free_mem, as locales must + be freed before freeing gconv steps arrays. */ +void __libc_freeres_fn_section +_nl_finddomain_subfreeres () { struct loaded_l10nfile *runp = _nl_loaded_domains; --- libc/intl/loadmsgcat.c.jj 2004-04-13 10:42:52.000000000 +0200 +++ libc/intl/loadmsgcat.c 2004-08-05 18:22:24.000000000 +0200 @@ -1387,7 +1387,7 @@ _nl_load_domain (domain_file, domainbind #ifdef _LIBC void -internal_function +internal_function __libc_freeres_fn_section _nl_unload_domain (domain) struct loaded_domain *domain; { --- libc/intl/gettextP.h.jj 2002-12-11 23:58:30.000000000 +0100 +++ libc/intl/gettextP.h 2004-08-05 18:21:57.000000000 +0200 @@ -1,5 +1,5 @@ /* Header describing internals of libintl library. - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000, 2001, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper , 1995. @@ -173,8 +173,6 @@ struct loaded_l10nfile *_nl_find_domain void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain, struct binding *__domainbinding)) internal_function; -void _nl_unload_domain PARAMS ((struct loaded_domain *__domain)) - internal_function; const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file, struct loaded_domain *__domain, struct binding *__domainbinding)) @@ -210,6 +208,9 @@ extern char *__bindtextdomain PARAMS ((c const char *__dirname)); extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname, const char *__codeset)); +extern void _nl_finddomain_subfreeres PARAMS ((void)) attribute_hidden; +extern void _nl_unload_domain PARAMS ((struct loaded_domain *__domain)) + internal_function attribute_hidden; #else extern char *libintl_gettext PARAMS ((const char *__msgid)); extern char *libintl_dgettext PARAMS ((const char *__domainname, --- libc/iconv/gconv_db.c.jj 2004-08-04 19:28:50.000000000 +0200 +++ libc/iconv/gconv_db.c 2004-08-05 18:27:42.000000000 +0200 @@ -791,6 +791,10 @@ libc_freeres_fn (free_mem) as ctype cleanup functions dereference steps arrays which we free below. */ _nl_locale_subfreeres (); + /* finddomain.c has similar problem. */ + extern void _nl_finddomain_subfreeres (void) attribute_hidden; + _nl_finddomain_subfreeres (); + if (__gconv_alias_db != NULL) __tdestroy (__gconv_alias_db, free); Jakub