From 6ce9d03d8acc3c1e8aa784f98cf853edab30c022 Mon Sep 17 00:00:00 2001 From: kris Date: Fri, 16 Nov 2007 01:26:42 +0000 Subject: [PATCH] Return NULL in reason_sort() if tail is NULL as it's possible tail never gets redefined. I think that's better than an assert(tail). Found with Coverity, CID 24 --- portreasons.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/portreasons.cc b/portreasons.cc index a841ad6c4..f4782ae6b 100644 --- a/portreasons.cc +++ b/portreasons.cc @@ -214,7 +214,9 @@ static state_reason_summary_t *reason_sort(state_reason_summary_t *list) { } p = q; } - tail->next = NULL; + if (!tail) + return NULL; + tail->next = NULL; if (nmerges <= 1) return list; insize *= 2;