From: Hemanth Thummala <hemanth.thummala@nutanix.com> To: Jeremy Allison <jra@samba.org>, Richard Sharpe <richard.sharpe@nutanix.com> CC: Saji VR <saji.vr@nutanix.com> Subject: Re: Memory leak while doing notify cancel? Hi Jeremy, Thank you for suggesting the patch to address the leak in smb_request. We have actually tested further with this fix and iden +tified(by Saji) that we still have a leak in notify_mid_map structure. From what I understood is that when destructor returns -1 and already reparented, we are returning from the while loop withou +t traversing the remaining children. This is leaving the notify_mid_map structure as detached child and never get a chance t +o free. We have verified that the following patch(by Saji) actually fixed the leak in notify_mid_map structure. --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -1475,7 +1475,7 @@ static inline void _talloc_free_children_internal(struct talloc_chunk *tc, * Destructor already reparented this child. * No further reparenting needed. */ - return; + continue; } if (new_parent == null_context) { struct talloc_chunk *p = talloc_parent_chunk(ptr); We would like to know if our understanding is correct. Thanks, Hemanth.
Created attachment 12070 [details] Proposed patch.
Created attachment 12075 [details] git-am fix for 4.4.next. Cherry-pick from patch that went into master. For 4.3.x we'll need to pick all the intermediate talloc patches before this will apply.
Created attachment 12080 [details] Patches for v4-4-test I've added one more patch (talloc/testsuite: Fix CID 1291641 - Logically dead code) in order to have a zero diff between 4.4 and master.
Comment on attachment 12080 [details] Patches for v4-4-test LGTM.