talloc

Tim Potter tpot at samba.org
Sun Jul 14 22:56:08 GMT 2002


On Sat, Jul 13, 2002 at 06:01:41PM +0200, Simo Sorce wrote:

> any objection into adding a function to talloc to import a previously
> allocated memory?
> 
> something like that:
> 
> bool talloc_memorize(TALLOC_CTX *t, void *src, size_t src_size)

Hi Simo.

Isn't this going to cause horrible problems if you pass in a a piece of
memory that has already been allocated by talloc?  It looks like you
must pass in memory allocated my mallloc() unless you want to have a
double free happening sometime later.  This will be very difficult to
debug.

> it would be useful to add allocated strings returned from another
> function to a talloc context ... the only problem I see is the size one.

Why not just use a talloc context for these allocated strings in the
first place?


Tim.




More information about the samba-technical mailing list