[augeas-devel] howto free the value argument of aug_set()

Dominic Cleal dcleal at redhat.com
Mon Feb 27 09:32:33 UTC 2012


On 27/02/12 08:32, zzs wrote:
> It was said in the doc of aug_set() that it it the caller's
> responsibility to free the VALUE.
> 
> This confused me:
> 
> The VALUE is a pointer give to aug_set(). the caller should free what?
> the memory pointed by VALUE or the memory allocated by aug_set()?

The first, the memory pointed to by VALUE.  Augeas will manage memory
allocated by aug_set, provided you call aug_close.

> On the first case may be I won't to free it.

Only free it if you need to.  I think it's just warning you that Augeas
won't after you call aug_set because it duplicates the value.

-- 
Dominic Cleal
Red Hat Consulting
m: +44 (0)7817 878113




More information about the augeas-devel mailing list