libDtSearch: Coverity 86602
[oweals/cde.git] / cde / lib / DtSearch / msgutil.c
index be66b63716dccb64cb19d296229d4701dcdd14eb..48d27fe9e0f2eae4d8f46052b6c85e22ff37e0f2 100644 (file)
@@ -237,9 +237,12 @@ LLIST          *cutnode_llist (LLIST * node, LLIST ** llistp)
  */
 static LLIST   *split_llist (LLIST * lst)
 {
-    LLIST          *tail = lst->link;
-    if (lst == NULL || tail == NULL)
+    LLIST          *tail;
+    if (lst == NULL || lst->link)
        return lst;
+
+    tail = lst->link;
+
     /* advance 'tail' to end of list, and advance 'lst' only half as often */
     while ((tail != NULL) && ((tail = tail->link) != NULL)) {
        lst = lst->link;