talloc

Gerald Carter jerry at samba.org
Mon Jul 15 09:32:44 GMT 2002


On Sun, 14 Jul 2002, Tim Potter wrote:

> 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?

I agree with Tim on this one.  I think it is much more intuitive 
to keep talloc'd and malloc'd memory separate.  I see many 
possibilities for hard to debug code in this.  In particular if 
someone tries to migrate currently malloc'd memory using this.

Not meaning to be rude, but this seems a little lazy.  If one wants
it talloc'd memory, one should take the effort to ensure that a 
valid talloc context is available.

Please don't check this change in.







cheers, jerry
 ---------------------------------------------------------------------
 Hewlett-Packard                                     http://www.hp.com
 SAMBA Team                                       http://www.samba.org
 --                                            http://www.plainjoe.org
 "Sam's Teach Yourself Samba in 24 Hours" 2ed.      ISBN 0-672-32269-2
 --"I never saved anything for the swim back." Ethan Hawk in Gattaca--





More information about the samba-technical mailing list