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

boyang boyang at suse.de
Fri Jan 9 07:07:18 GMT 2009

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!
> Jeremy.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: backport-event-context-and-krb5-refresh-v3-0-test.diff
Type: text/x-patch
Size: 30278 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090109/20f0b282/backport-event-context-and-krb5-refresh-v3-0-test.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: backport-event-context-and-krb5-refresh-v3-2-test.diff
Type: text/x-patch
Size: 29566 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090109/20f0b282/backport-event-context-and-krb5-refresh-v3-2-test.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: boyang.vcf
Type: text/x-vcard
Size: 187 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090109/20f0b282/boyang.vcf

More information about the samba-technical mailing list