From 03991ab0734ecbb87a75238d1356fbe0e5b1d38d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 12 Aug 2008 13:35:15 -0700 Subject: 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. (This used to be commit 8c630efd25cf17aff59448ca05c1b44a41964b16) --- source3/lib/util_unistr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source3/lib/util_unistr.c') diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 76235ad041..4e78d1b064 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -33,6 +33,7 @@ static uint8 *valid_table; static bool upcase_table_use_unmap; static bool lowcase_table_use_unmap; static bool valid_table_use_unmap; +static bool initialized; /** * Destroy global objects allocated by load_case_tables() @@ -59,6 +60,7 @@ void gfree_case_tables(void) else SAFE_FREE(valid_table); } + initialized = false; } /** @@ -70,15 +72,14 @@ void gfree_case_tables(void) void load_case_tables(void) { - static int initialised; char *old_locale = NULL, *saved_locale = NULL; int i; TALLOC_CTX *frame = NULL; - if (initialised) { + if (initialized) { return; } - initialised = 1; + initialized = true; frame = talloc_stackframe(); -- cgit