summaryrefslogtreecommitdiff
path: root/source3/lib/util_unistr.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-08-12 13:35:15 -0700
committerJeremy Allison <jra@samba.org>2008-08-12 13:35:15 -0700
commit03991ab0734ecbb87a75238d1356fbe0e5b1d38d (patch)
treec96c68c0f2fd8359c2250621f4b0938903ae385f /source3/lib/util_unistr.c
parent9caabc441b3bfe860f9719cf64b6646f58a5cb59 (diff)
downloadsamba-03991ab0734ecbb87a75238d1356fbe0e5b1d38d.tar.gz
samba-03991ab0734ecbb87a75238d1356fbe0e5b1d38d.tar.bz2
samba-03991ab0734ecbb87a75238d1356fbe0e5b1d38d.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. (This used to be commit 8c630efd25cf17aff59448ca05c1b44a41964b16)
Diffstat (limited to 'source3/lib/util_unistr.c')
-rw-r--r--source3/lib/util_unistr.c7
1 files changed, 4 insertions, 3 deletions
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();