bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some free()s in module 'relocatable'


From: Sylvain Beucler
Subject: Re: Some free()s in module 'relocatable'
Date: Tue, 8 Jan 2008 18:17:44 +0100
User-agent: Mutt/1.5.17 (2007-11-01)

Hi,

> > > > Another thing:, the relocatable module documentation recommends using:
> > > >   bindtextdomain (PACKAGE, relocate (LOCALEDIR));
> > > > however, the result of relocate may be LOCALEDIR itself (no
> > > > relocation) or a newly allocated string.
> 
> Yes, this is by design: The relocate() call is meant to be a no-op when
> not relocating. People like to use a facility with extra features only when
> it costs nothing if the feature is not used.

Yeah, but that leaks.

> But, more importantly, there's no documentation that says that relocate()
> returns either the argument string or a freshly allocated string; it could
> also return - say - a pointer into a hidden global obstack. In fact, one
> of the return paths of the function (see lib/relocatable.c) returns a
> cached global variable that you must not free.

What should be done instead?

-- 
Sylvain




reply via email to

[Prev in Thread] Current Thread [Next in Thread]