From 7ecbdc866cbf0f41a45827c308cdf4d2250ff866 Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Mon, 2 Jul 2018 23:23:44 +0100 Subject: [PATCH] libDtSearch: Coverity 86602 --- cde/lib/DtSearch/msgutil.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cde/lib/DtSearch/msgutil.c b/cde/lib/DtSearch/msgutil.c index be66b637..48d27fe9 100644 --- a/cde/lib/DtSearch/msgutil.c +++ b/cde/lib/DtSearch/msgutil.c @@ -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; -- 2.25.1