The branch, v3-0-test has been updated via 45514fc5d85221339a4ee55b9f9f78c917b2fd19 (commit) from ffa704347a9cf10de20105e3dd07963f975cbd77 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test - Log ----------------------------------------------------------------- commit 45514fc5d85221339a4ee55b9f9f78c917b2fd19 Author: Jeremy Allison <[EMAIL PROTECTED]> Date: Wed Oct 1 13:23:36 2008 -0700 Fix use of DLIST_REMOVE as spotted by Constantine Vetoshev <[EMAIL PROTECTED]>. 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. ----------------------------------------------------------------------- Summary of changes: source/nsswitch/winbindd_util.c | 3 +-- source/smbd/conn.c | 2 +- source/web/statuspage.c | 5 +++-- 3 files changed, 5 insertions(+), 5 deletions(-) Changeset truncated at 500 lines: diff --git a/source/nsswitch/winbindd_util.c b/source/nsswitch/winbindd_util.c index 130d45c..e72cd7c 100644 --- a/source/nsswitch/winbindd_util.c +++ b/source/nsswitch/winbindd_util.c @@ -771,13 +771,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; diff --git a/source/smbd/conn.c b/source/smbd/conn.c index 610e641..4a78b5a 100644 --- a/source/smbd/conn.c +++ b/source/smbd/conn.c @@ -261,8 +261,8 @@ void conn_free_internal(connection_struct *conn) /* Free vfs_connection_struct */ handle = conn->vfs_handles; while(handle) { - DLIST_REMOVE(conn->vfs_handles, handle); thandle = handle->next; + DLIST_REMOVE(conn->vfs_handles, handle); if (handle->free_data) handle->free_data(&handle->data); handle = thandle; diff --git a/source/web/statuspage.c b/source/web/statuspage.c index e4d726c..7b21a63 100644 --- a/source/web/statuspage.c +++ b/source/web/statuspage.c @@ -42,9 +42,10 @@ static void initPid2Machine (void) { /* show machine name rather PID on table "Open Files"? */ if (PID_or_Machine) { - PIDMAP *p; + PIDMAP *p, *next; - for (p = pidmap; p != NULL; ) { + for (p = pidmap; p != NULL; p = next) { + next = p->next; DLIST_REMOVE(pidmap, p); SAFE_FREE(p->machine); SAFE_FREE(p); -- Samba Shared Repository