[rrd-developers] [PATCH] rrd_client.c issues

Svante Signell svante.signell at gmail.com
Mon Aug 19 20:10:27 CEST 2013

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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_get_path.c
Type: text/x-csrc
Size: 3542 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20130819/bd229300/attachment.c 

More information about the rrd-developers mailing list