Subject: Re: strerror(3) memory leak ?
To: Rui Paulo <rpaulo@fnop.net>
From: Arnaud Lacombe <lists-netbsd@sigfpe.info>
List: current-users
Date: 03/27/2006 03:22:42
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.
regards,
Arnaud