Subject: Re: strerror(3) memory leak ?
To: Christos Zoulas <christos@astron.com>
From: Nicolas Joly <njoly@pasteur.fr>
List: current-users
Date: 03/27/2006 12:57:20
On Mon, Mar 27, 2006 at 02:45:50AM +0000, Christos Zoulas wrote:
> In article <20060327012241.GA49616@aries.rezid.net>,
> Arnaud Lacombe  <lists-netbsd@sigfpe.info> wrote:
> >On Mon, Mar 27, 2006 at 12:35:56AM +0100, Rui Paulo wrote:
> >> Nicolas Joly <njoly@pasteur.fr> writes:
> >> > #include <string.h>
> >> >
> >> > int main() {
> >> >   char *msg;
> >> >
> >> >   while (1) {
> >> >     msg = strerror(1);
> >> >   }
> >> >
> >> >   return 0; }
> >> >
> >> > Did i missed something, or this is a real leak ?
> >> 
> >> I think this is a real leak and is related to NLS/i18n.
> >yes, it seems so.
> >
> >The following code extracted from strerror_r() also produce the leak:
> >
> >int main() {
> >  nl_catd catd;
> >  while (1) {
> >    catd = catopen("libc", NL_CAT_LOCALE);
> >    catclose(catd);
> >  }
> >  return 0;
> >}
> >
> >The leak seems to be in lib/libc/citrus/* somewhere in
> >_citrus_lookup_simple() as if catopen.c is build without -DCITRUS (
> >which implies that citrus/*.h are not included and _lookup_alias() is
> >hardcoded), the leak doesn't occur. I doesn't have time to dig more by
> >now, sorry.
> 
> cvs update and recompile.

Thanks Christos, problem gone.

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.