svn commit: samba r11961 - in trunk/source: . lib utils

Jeremy Allison jra at samba.org
Wed Nov 30 01:31:08 GMT 2005


On Wed, Nov 30, 2005 at 11:34:49AM +1100, tridge at samba.org wrote:
> Jeremy,
> 
>  > Yes, it's a copy of talloc_report_full, but uses a Samba3 specific output
>  > function I don't think is available in Samba4. I originally tried to use
>  > talloc_vasprintf_append() to build the output but kept getting valgrind
>  > errors about reusing free'd memory.
> 
> can you show me the code that caused that? 
> 
> btw, you do know that talloc_vasprintf_append() is like realloc() in
> that it can (and often does) change the pointer?

Yes, that was the problem. I junked the code but it was essentially
calling talloc_vasprintf_append() where I'm currently calling sprintf_append().

>  > I think it was to do with trying to print the string you're
>  > constructing as talloc_vasprintf_append() calls
>  > talloc_set_name_const with the constructed string.... 
> 
> hmm, I don't quite follow this, but perhaps the traversal of the tree
> was traversing into the memory that you were using for the traversal?
> I can see that tying you in knots. I guess you could check for that at
> the top of the function and skip out.

Yes, it *really* tied me in knots :-). Valgrind too :-). That's why I
eventually added the sprintf_append() calls (nicely isolated in a _SAMBA_BUILD_
macro :-).

Jeremy.


More information about the samba-technical mailing list