[PATCH] Minor cleanup to libnet_join_member

Jeremy Allison jra at samba.org
Thu Jan 25 18:34:28 UTC 2018


On Thu, Jan 25, 2018 at 04:52:04PM +0100, Swen Schillig via samba-technical wrote:
> On Thu, 2018-01-25 at 15:16 +0100, Volker Lendecke via samba-technical
> wrote:
> > On Thu, Jan 25, 2018 at 03:03:56PM +0100, Swen Schillig via samba-
> > technical wrote:
> > > On Thu, 2018-01-25 at 14:49 +0100, Volker Lendecke via samba-
> > > technical
> > > wrote:
> > > > On Thu, Jan 25, 2018 at 02:33:12PM +0100, Swen Schillig via
> > > > samba-
> > > > technical wrote:
> > > > > 
> > > > 
> > > > Bike-shedding-alert: talloc_move() is higly preferred over
> > > > talloc_steal() these days...
> > > > 
> > > > Volker
> > > 
> > > I was thinking about it as well, but I didn't see the point to zero
> > > the "old" variable just before destroying it anyway.
> > 
> > That's true. But TALLOC_FREE instead of talloc_free is overkill in
> > many places too. It's just careful programming. We want to crash
> > instead of use-after-free of pointers.
> > 
> > Volker
> 
> The data we're talking about is local, the processing is synchronous
> and the very next command is free'in the memory.
> Since talloc_move is not atomic, it is not any bit more secure here
> then talloc_steal.
> 
> Anyhow, if there's no other opinion 'til tomorrow, 
> I'll update the code for you to talloc_move :-)

Yes, please use talloc_move. I sometime git grep for talloc_steal
to look for memory errors (as the two are usually synonymous :-).



More information about the samba-technical mailing list