diff options
Diffstat (limited to 'source3/passdb/pdb_interface.c')
-rw-r--r-- | source3/passdb/pdb_interface.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index 340867a5a6..b4e1bd436c 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -1711,7 +1711,7 @@ static NTSTATUS pdb_default_lookup_names(struct pdb_methods *methods, static int pdb_search_destructor(struct pdb_search *search) { - if (!search->search_ended) { + if ((!search->search_ended) && (search->search_end != NULL)) { search->search_end(search); } return 0; @@ -1733,6 +1733,7 @@ struct pdb_search *pdb_search_init(TALLOC_CTX *mem_ctx, result->num_entries = 0; result->cache_size = 0; result->search_ended = False; + result->search_end = NULL; /* Segfault appropriately if not initialized */ result->next_entry = NULL; @@ -2021,7 +2022,8 @@ NTSTATUS make_pdb_method( struct pdb_methods **methods ) { /* allocate memory for the structure as its own talloc CTX */ - if ( !(*methods = TALLOC_ZERO_P(talloc_autofree_context(), struct pdb_methods) ) ) { + *methods = talloc_zero(talloc_autofree_context(), struct pdb_methods); + if (*methods == NULL) { return NT_STATUS_NO_MEMORY; } |