From: Peter Howkins Date: Mon, 2 Jul 2018 22:23:44 +0000 (+0100) Subject: libDtSearch: Coverity 86602 X-Git-Tag: 2.3.0a~244 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7ecbdc866cbf0f41a45827c308cdf4d2250ff866;p=oweals%2Fcde.git libDtSearch: Coverity 86602 --- 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;