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

boyang boyang at suse.de
Tue Jan 6 05:19:41 GMT 2009


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).
>   
v2-event-context-master.diff frees check_online_event. But I think you
don't need it now. Because all events freeing work will be done in
winbindd_reinit_after_fork() :-). As you said.
>   
>> Looks like ccache_regain_all_now relies on entry->refresh_time to judge
>> whether the handler is krb5_ticket_refresh_handler or
>> krb5_ticket_gain_handler. Therefore, we must set entry->refresh_time
>> before event_add_timed to make ccache_regain_all_now work correctly.
>> I'll post a separate patch later.
>>     
>
> Please send asap so I can evaluate it as I
> back-port Metze's code to 3.3-test.
>   
v2-krb5-refresh-master.diff addresses this. :-) Pls review it, thanks!
> Thanks,
>
> Jeremy.
>
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: v2-event-context-master.diff
Type: text/x-patch
Size: 1086 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090106/9f308b73/v2-event-context-master.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v2-krb5-refresh-master.diff
Type: text/x-patch
Size: 2756 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090106/9f308b73/v2-krb5-refresh-master.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/20090106/9f308b73/boyang.vcf


More information about the samba-technical mailing list