summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/dlinklist.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/source3/include/dlinklist.h b/source3/include/dlinklist.h
index e68f2a4d86..cf75404c56 100644
--- a/source3/include/dlinklist.h
+++ b/source3/include/dlinklist.h
@@ -47,7 +47,7 @@
if ((p)->prev) (p)->prev->next = (p)->next; \
if ((p)->next) (p)->next->prev = (p)->prev; \
} \
- if ((p)) (p)->next = (p)->prev = NULL; \
+ if ((p) && ((p) != (list))) (p)->next = (p)->prev = NULL; \
}
/* promote an element to the top of the list */