summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-02-11 22:47:12 +0000
committerJeremy Allison <jra@samba.org>2004-02-11 22:47:12 +0000
commit16733020e3b61e7beb7c7a4f7bafa796ee3e92e2 (patch)
tree89b347ffc86f248001100e0a5c89e0bb81047c7c /source3/passdb
parent3cd61b1597ea6907a74720d028ebd2fec6453f4c (diff)
downloadsamba-16733020e3b61e7beb7c7a4f7bafa796ee3e92e2.tar.gz
samba-16733020e3b61e7beb7c7a4f7bafa796ee3e92e2.tar.bz2
samba-16733020e3b61e7beb7c7a4f7bafa796ee3e92e2.zip
Don't set an iterator to a piece of free'd memory, store it first.
Jeremy. (This used to be commit e914230a2d1a7b515bd7859d655d6555b7d3e67e)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/pdb_tdb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index e4ef51a46d..22818b058b 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -143,13 +143,14 @@ static NTSTATUS tdbsam_setsampwent(struct pdb_methods *my_methods, BOOL update)
static void tdbsam_endsampwent(struct pdb_methods *my_methods)
{
struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)my_methods->private_data;
- struct pwent_list *ptr;
+ struct pwent_list *ptr, *ptr_next;
close_tdb(tdb_state);
/* clear out any remaining entries in the list */
- for ( ptr=tdbsam_pwent_list; ptr; ptr=ptr->next ) {
+ for ( ptr=tdbsam_pwent_list; ptr; ptr = ptr_next ) {
+ ptr_next = ptr->next;
DLIST_REMOVE( tdbsam_pwent_list, ptr );
SAFE_FREE( ptr->key.dptr);
SAFE_FREE( ptr );