Created attachment 6877 [details] Examine, compile and run this tiny program. Running a program that creates a context, opens a directory and frees the context results in a "no talloc stackframe around, leaking memory" message being sent to stdout. Steps to reproduce: 1) Compile the attached program: gcc test.c -lsmbclient -o reprod 2) Run it: ./reprod 3) Observe the error message being printed to stdout. Be sure that the program is attempting to open a directory that you actually have access to (see line 10). Otherwise the error message is not printed out.
I found a solution to avoid this situation. In the function where you seeing this error, you need to allocate stack frame using the below way TALLOC_CTX *frame = talloc_stackframe(); and before your function exit you need to call TALLOC_FREE(frame); Some one who knows better on these stack frame call can add here.
Created attachment 9821 [details] patch for master to fix this This patch should fix the issue.
Andrew, can you reverse the: errno = XXXX TALLOC_FREE(frame); to be : TALLOC_FREE(frame); errno = XXXXX as it's possible TALLOC_FREE might set an errno (currently doesn't but it's safer not to assume). Then I'll push to master and +1 for 4.0.next and 4.1.next. Thanks ! Jeremy.
Created attachment 9823 [details] git-am fix for master. Decided not to waste your time and did it myself :-). If you +1 I'll push to master. Cheers, Jeremy.
This issue (I think) is affecting the just-released Ubuntu 14.04. Downstream bug: https://launchpad.net/bugs/1257186. It seems to me that this is creating noise for us rather than having a more significant impact, but as a consequence we do have a ton of reports. Though I'm not completely sure. I could not reproduce Mr Temporary's case successfully with 2:4.1.6+dfsg-1ubuntu2 (based on 4.1.6), and Jeremy's patch in comment 4 did not fix my test case (sudo passwd ... with libpam-smbpass enabled) either. Is my problem a separate issue, or are there additional functions that need to be wrapped in talloc_stackframe()?
Created attachment 10067 [details] patches cherry-picked from master for 4.1 Attached are the cherry-picked patches for this issue both in libsmbclient and in pam_smbpass (which is what is causing most of the noise).
*** Bug 10420 has been marked as a duplicate of this bug. ***
Comment on attachment 10067 [details] patches cherry-picked from master for 4.1 LGTM.
Re-assigning to Karolin for inclusion in 4.0.next.
(In reply to comment #9) > Re-assigning to Karolin for inclusion in 4.0.next. Pushed to autobuild-v4-1-test. Jeremy, did you really mean 4.0.next here?
No, it was a typo - 4.1.x is fine !
Pushed to v4-1-test. Closing out bug report. Thanks!