summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-04-04 03:53:43 +0000
committerTim Potter <tpot@samba.org>2002-04-04 03:53:43 +0000
commit18d011d736fbac006735e5a45e9a815fd71f8fb2 (patch)
tree603b2c41b158e5ff14bdf39d5d4944e8bad56a06
parent7bfa5ead490e382d3dd534343639926a7025ce9c (diff)
downloadsamba-18d011d736fbac006735e5a45e9a815fd71f8fb2.tar.gz
samba-18d011d736fbac006735e5a45e9a815fd71f8fb2.tar.bz2
samba-18d011d736fbac006735e5a45e9a815fd71f8fb2.zip
Fixed memory leak in make_pdb_context_name()
Some reformatting and spelling fixes. (This used to be commit a0f7bbad11a0c0f1ecd930626289c5ff493b0f1d)
-rw-r--r--source3/passdb/pdb_interface.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 80b268994b..435b627da6 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -177,7 +177,8 @@ static NTSTATUS make_pdb_context(struct pdb_context **context)
NTSTATUS make_pdb_context_name(struct pdb_context **context, const char *selected)
{
- /* HINT: Don't store 'selected' becouse its often an lp_ string and will 'go away' */
+ /* HINT: Don't store 'selected' becouse its often an lp_ string and
+ will 'go away' */
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
int i;
char *module_name = smb_xstrdup(selected);
@@ -196,18 +197,20 @@ NTSTATUS make_pdb_context_name(struct pdb_context **context, const char *selecte
trim_string(module_name, " ", " ");
- if (!NT_STATUS_IS_OK(nt_status = make_pdb_context(context))) {
- return nt_status;
- }
+ if (!NT_STATUS_IS_OK(nt_status = make_pdb_context(context)))
+ goto done;
- DEBUG(5,("Attempting to find an passdb backend to match %s (%s)\n", selected, module_name));
- for (i = 0; builtin_pdb_init_functions[i].name; i++)
- {
- if (strequal(builtin_pdb_init_functions[i].name, module_name))
- {
- DEBUG(5,("Found pdb backend %s (at pos %d)\n", module_name, i));
- if (NT_STATUS_IS_OK(nt_status
- = builtin_pdb_init_functions[i].init(*context, &(*context)->pdb_selected, module_location))) {
+ DEBUG(5,("Attempting to find an passdb backend to match %s (%s)\n",
+ selected, module_name));
+
+ for (i = 0; builtin_pdb_init_functions[i].name; i++) {
+ if (strequal(builtin_pdb_init_functions[i].name,
+ module_name)) {
+
+ DEBUG(5,("Found pdb backend %s (at pos %d)\n",
+ module_name, i));
+
+ if (NT_STATUS_IS_OK(nt_status = builtin_pdb_init_functions[i].init(*context, &(*context)->pdb_selected, module_location))) {
DEBUG(5,("pdb backend %s has a valid init\n", selected));
} else {
DEBUG(0,("pdb backend %s did not correctly init (error was %s)\n", selected, nt_errstr(nt_status)));
@@ -221,16 +224,21 @@ NTSTATUS make_pdb_context_name(struct pdb_context **context, const char *selecte
DEBUG(0,("failed to select passdb backed!\n"));
talloc_destroy((*context)->mem_ctx);
*context = NULL;
- return nt_status;
+ goto done;
}
- return NT_STATUS_OK;
+ nt_status = NT_STATUS_OK;
+
+ done:
+ SAFE_FREE(module_name);
+
+ return nt_status;
}
/******************************************************************
- Return an already initilised pdb_context, to facilitate backward
- compatiablity (see functions below).
+ Return an already initialised pdb_context, to facilitate backward
+ compatibility (see functions below).
*******************************************************************/
static struct pdb_context *pdb_get_static_context(BOOL reload)
@@ -256,7 +264,7 @@ static struct pdb_context *pdb_get_static_context(BOOL reload)
#if !defined(WITH_NISPLUS_SAM)
/******************************************************************
- Backward compatability functions for the original passdb interface
+ Backward compatibility functions for the original passdb interface
*******************************************************************/
BOOL pdb_setsampwent(BOOL update)