We "TALLOC_FREE(curr)" and assign prev=curr in the for-loop header.
This will lead to "prev"==NULL always. In this loop, we do not need
to correctly re-shuffle the linked list, we delete all from the
beginning anyway.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jun 11 17:26:53 CEST 2012 on sn-devel-104
void vfs_remove_all_fsp_extensions(files_struct *fsp)
{
struct vfs_fsp_data *curr;
- struct vfs_fsp_data *prev;
+ struct vfs_fsp_data *next;
+
+ for (curr = fsp->vfs_extension; curr; curr = next) {
+
+ next = curr->next;
+ fsp->vfs_extension = next;
- for (curr = fsp->vfs_extension, prev = NULL;
- curr;
- prev = curr, curr = curr->next)
- {
- if (prev) {
- prev->next = curr->next;
- } else {
- fsp->vfs_extension = curr->next;
- }
if (curr->destroy) {
curr->destroy(EXT_DATA_AREA(curr));
}