diff options
author | Jeremy Allison <jra@samba.org> | 2008-08-12 13:34:00 -0700 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2008-08-13 16:11:16 +0200 |
commit | 9fcc15e0307ec1621482101b5730de1a635a191d (patch) | |
tree | 9db3dfe3362c2ddc5ce105f0b32d5624854de431 /examples | |
parent | 9936dd1f611c275a38b9e5148bc6bf383bc306c0 (diff) | |
download | samba-9fcc15e0307ec1621482101b5730de1a635a191d.tar.gz samba-9fcc15e0307ec1621482101b5730de1a635a191d.tar.xz samba-9fcc15e0307ec1621482101b5730de1a635a191d.zip |
Fix bug 5686 - libsmbclient segfaults with more than one SMBCCTX.
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.
Jeremy.
(cherry picked from commit 4779f1efccc8364fd8b3ba446aa96ba0bddec689)
Diffstat (limited to 'examples')
-rw-r--r-- | examples/libsmbclient/Makefile | 4 | ||||
-rw-r--r-- | examples/libsmbclient/testctx.c | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index dabc8e9bb42..e6afdeb5192 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -94,6 +94,10 @@ testwrite: testwrite.o @echo Linking testwrite $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt +testctx: testctx.o + @echo Linking testctx + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt + smbsh: make -C smbwrapper diff --git a/examples/libsmbclient/testctx.c b/examples/libsmbclient/testctx.c new file mode 100644 index 00000000000..8820bc8342e --- /dev/null +++ b/examples/libsmbclient/testctx.c @@ -0,0 +1,17 @@ +#include <libsmbclient.h> + +void create_and_destroy_context (void) +{ + SMBCCTX *ctx; + ctx = smbc_new_context (); + smbc_init_context (ctx); + + smbc_free_context (ctx, 1); +} + +int main (int argc, char **argv) +{ + create_and_destroy_context (); + create_and_destroy_context (); + return 0; +} |