summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-10-01 13:15:54 -0700
committerJeremy Allison <jra@samba.org>2008-10-01 13:15:54 -0700
commite4f5bfb34b7a515e2cf107eb94489260594b8733 (patch)
tree5d50e1cbf15a6e2848b810f9b9d83c5441521bde /source3/winbindd
parent370cbe0060cb2670c7f65100954dac6c63030ca0 (diff)
downloadsamba-e4f5bfb34b7a515e2cf107eb94489260594b8733.tar.gz
samba-e4f5bfb34b7a515e2cf107eb94489260594b8733.tar.bz2
samba-e4f5bfb34b7a515e2cf107eb94489260594b8733.zip
Fix use of DLIST_REMOVE as spotted by Constantine Vetoshev <gepardcv@gmail.com>.
This API is unusual in that if used to remove a non-list head it nulls out the next and prev pointers. This is what you want for debugging (don't want an entry removed from the list to be still virtually linked into it) but means there is no consistent idiom for use as the next and prev pointers get trashed on removal from the list, meaning you must save them yourself. You can use it one way when deleting everything via the head pointer, as this preserves the next pointer, but you *must* use it another way when not deleting everything via the head pointer. Fix all known uses of this (the main one is in conn_free_internal() and would not free all the private data entries for vfs modules. The other changes in web/statuspage.c and winbindd_util.c are not strictly neccessary, as the head pointer is being used, but I've done them for consistency. Long term we must revisit this as this API is too hard to use correctly. Jeremy.
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd_util.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index b8cb27c797..fdfc8ed9d1 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -1075,13 +1075,12 @@ void free_getent_state(struct getent_state *state)
temp = state;
while(temp != NULL) {
- struct getent_state *next;
+ struct getent_state *next = temp->next;
/* Free sam entries then list entry */
SAFE_FREE(state->sam_entries);
DLIST_REMOVE(state, state);
- next = temp->next;
SAFE_FREE(temp);
temp = next;