From 16733020e3b61e7beb7c7a4f7bafa796ee3e92e2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 11 Feb 2004 22:47:12 +0000 Subject: Don't set an iterator to a piece of free'd memory, store it first. Jeremy. (This used to be commit e914230a2d1a7b515bd7859d655d6555b7d3e67e) --- source3/passdb/pdb_tdb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/passdb') 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 ); -- cgit