talloc()

Andrew Tridgell tridge at linuxcare.com
Fri Aug 11 07:47:03 GMT 2000


Luke,

nope, that makes no sense. There is no allocated area when you ask for
zero bytes. You can't stick values before or after an area that
doesn't exist.

Jerry did the right thing in his commit.

btw, if what you want is guard regions around all non-zero sized
allocs then that is normally a good idea, but doesn't actually work
for talloc(). In a normal alloc there is a free() fn, and the free fn
can check the guard areas and give a warning if they are corrupted. In
the case of talloc there is no free fn so the guard areas would be
useless.

Cheers, Tridge

> > To track down those bugs I suggest instead we change talloc() to
> > always return 0xdeadbeef for allocations of size zero. This will cause
> > the bugs to show up a lot earlier and will make them easier to
> > identify.
> 
> suggest putting 0xdeafbeef _before_ the malloc'd area and 0xxbeefdead
> _after_.
> 
> 0xdeafbeefmemmemmemmem0xbeefdead.





More information about the samba-technical mailing list