[PATCH] fix smbclient segfault

Jeremy Allison jra at samba.org
Mon Sep 22 13:57:43 MDT 2014


On Mon, Sep 22, 2014 at 09:24:30PM +0200, Michael Adam wrote:
> On 2014-09-22 at 12:20 -0700, Jeremy Allison wrote:
> > On Mon, Sep 22, 2014 at 10:15:10AM +0200, Andreas Schneider wrote:
> > > On Monday 22 September 2014 09:59:34 Michael Adam wrote:
> > > > Hi,
> > > 
> > > Hey,
> > >  
> > > > shouldn't subreq be freed before leaving the function,
> > > > i.e. further down?
> > > 
> > > to be honest, I'm not sure. A bit further down smbXcli_req_set_pending(subreq) 
> > > is called and I guess it needs to live longer cause of that call.
> > 
> > Yep, looks correct to me. smbXcli_req_set_pending(subreq) ensures
> > the subreq must live longer than this function.
> 
> But should be freed in all failure cases, I think.

Not needed IMHO. subreq is hung off state,
which (as is req) is hung off the calling mem_ctx,
which in both cases is a talloc_stackfram().

But we can add that in if you really want to :-).

Jeremy.


More information about the samba-technical mailing list