svn commit: samba r22539 - in branches: SAMBA_3_0/source/lib/talloc SAMBA_3_0_25/source/lib/talloc SAMBA_4_0/source/lib/talloc

tridge at samba.org tridge at samba.org
Sat Apr 28 21:30:36 GMT 2007


 > can you also update the documentation?
 > lib/talloc/talloc.3.xml and lib/talloc/talloc_guide.txt

NO!!!!!

talloc checking for 'zero' as special is totally bogus. Please don't
waste time updating the docs, or updating talloc. Please also remove
it from the samba4 talloc.

Jeremy, if you want a special wrapper for Samba3, then please create
your own lib/util_talloc.c and put the wrapper there. Better still,
think some more and I think you will realise that returning a valid
pointer for a zero length talloc is _correct_. This is even more the
case for talloc() than it is for malloc(), as for talloc the context
matters, so it is a quite valid and useful pattern to create an
initially zero length piece of memory and expand it later (as was done
in Samba3 and which was broken by your change).

I haven't looked at the bug that triggered this thread, but I'm
willing to bet the bug was not truly caused by talloc returning a
pointer on zero length, but instead by a routine not validating its
inputs for the constraints of the routine, and now you've put in code
to use talloc as a crutch for incorrect parameter checking.

Get this out of talloc.c and talloc.h please. The _strict() idea is
bogus. The "strictly correct" behaviour is exactly what talloc already
did. This was no accident in the design of talloc - it is exactly as
it was designed to behave.

Cheers, Tridge


More information about the samba-technical mailing list