The Samba-Bugzilla – Bug 5686
libsmbclient segfaults with more than one SMBCCTX
Last modified: 2008-08-14 17:26:27 UTC
Author: Andreas Schneider <firstname.lastname@example.org>
Date: Tue Jul 15 14:57:32 2008 +0200
Release still reachable memory if the smbclient context is freed.
Signed-off-by: Andreas Schneider <email@example.com>
(cherry picked from commit 88c9cf2fdc8f3d704f7f27c25ef6dc6940d451d3)
seems to be incorrect. It assumes that only one smbclient context is in use at a time, and frees global resources.
A test case showing the problem can be found here:
It creates and frees two smbclient contexts. Creating the second context causes a segmentation fault.
Got it - thanks. I'll add a refcount here.
Created attachment 3467 [details]
Here is a patch to allow many subsystems to be re-initialized. The only functional change I made was to remove the null context tracking, as the memory allocated here is designed to be left for the complete lifetime of the program. Freeing this early (when all smb contexts are destroyed) could crash other users of talloc.
Fixed for 3.2.2.