[rrd-developers] [PATCH] rrd_client.c issues
Tobias Oetiker
tobi at oetiker.ch
Mon Aug 19 20:54:29 CEST 2013
Hi Svante,
Today Svante Signell wrote:
> On Mon, 2013-08-19 at 18:33 +0200, Tobias Oetiker wrote:
>
> > > > I can only tell you when I see the patch ...
> >
> > if I am reading your code corectly, you are causing a memory leak
> > by makeing get_path return an allocated string instead of a
> > constant ... the root cause of the problem is that you are
> > changeing the API of get_path ...
>
> Yes, there is a memory leak introduced by allocing the string instead of
> having a constant one. Regarding the API the only code calling
> get_path() is in rrd_client.c.
>
> > for backward compatibility this is rather sub optimal ...
> >
> > better choose a new function name and whoever is using it knows
> > that they have to free the data they get from the call.
>
> What about the new version, here get_path is defined differently
> depending on whether POSIX.1-2008 is supported or not by #if-ing on
> _POSIX_VERSION (see man realpath). However, I can use a different name
> for the alloced version compared to the constant version.
I just realice that get_path is a static function, so there is no
problem 'fixing/changeing' it since it is not visible from the
outside.
sorry for the confusion
cheers
tobi
> Thanks,
> Svante
>
--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900
More information about the rrd-developers
mailing list