[PATCH] clean the event context after fork in fork_domain_child()

Jeremy Allison jra at samba.org
Sat Jan 10 22:34:02 GMT 2009


On Fri, Jan 09, 2009 at 03:07:18PM +0800, boyang wrote:
> Jeremy Allison wrote:
> > On Tue, Jan 06, 2009 at 01:19:41PM +0800, boyang wrote:
> >   
> >> Jeremy Allison wrote:
> >>     
> >>> I know it causes a memory leak, but it can't lead to
> >>> double free. Remember, Metze's patch removes the
> >>> event pointers from the linked list, but doesn't
> >>> free them. So even if some codepath has a saved
> >>> pointer and calls TALLOC_FREE() on it there won't
> >>> be a double free, the saved pointer hasn't been
> >>> freed. That's why it causes a memory leak.
> >>>
> >>> Doing it this way is safer than trying to free
> >>> the event pointers inside the event code, that
> >>> way can lead to crashes if the saved pointer
> >>> is referenced.
> >>>
> >>> When I've added the code to convert the
> >>> reinit_after_fork() calls to the individual
> >>> winbindd_reinit_after_fork() etc., this
> >>> won't be a problem as part of the 
> >>> winbindd_reinit_after_fork() call will be
> >>> code to free all pending events and null out
> >>> their saved pointers, so the event_context_reinit()
> >>> should be a no-op (as all the events on the
> >>> list will already have been freed).
> >>>   
> >
> > Ok, I've finished doing a lot of cleanup work on the
> > event code in winbindd. It's all checked into 3.3 and
> > master. Please review.
> >
> > If you feel it's working, feel free to back-port to 3.2
> > and/or 3.0.x and I'll commit patches for you. I'm not
> > doing that work yet as I'm not sure if we're doing any
> > more 3.2.x releases or just moving on to 3.3.0.
> >   
> Hi, Jeremy && metze:
>      I have ported the event context clean code and krb5 refresh chain
> code back to v3-0 and v3-2. There are two commit in each of the two
> attachments. One commit is for event context and another for krb5
> refresh chain. Please review it. Thanks!

Pushed, thanks !

Jeremy.


More information about the samba-technical mailing list