talloc()

Sander Striker s.striker at striker.nl
Thu Aug 10 08:50:19 GMT 2000


>Here's a little be on interesting information...
>
>two consecutive calls to talloc() of 0 size will return 
>pointers to the same memory location.  This has come up in 
>prs_unistr().  If the amout of allocated space needed is 0,
>the the str->buffer will still get assigned a memory address
>by prs_alloc_mem().
>
>**and the next prs_unistr will get the same memory!

Argh...

Hmmm, does it happen often that pieces of 0 memory are first
reserved and later realloc()'ed to something bigger?
If this is the case and it happens a lot in marshalling I
should maybe do a little optimization on the sma code in TNG;
return NULL when 0 bytes are requested instead of returning
a block off the minimal size returned by sma. Would this be
preferred behaviour?

Sander





More information about the samba-technical mailing list