add_next_timeout: minor restructure of code
authorDaniel Stenberg <daniel@haxx.se>
Wed, 8 Aug 2012 12:50:32 +0000 (14:50 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 8 Aug 2012 12:50:32 +0000 (14:50 +0200)
By reading the ->head pointer and using that instead of the ->size
number to figure out if there's a list remaining we avoid the (false
positive) clang-analyzer warning that we might dereference of a null
pointer.

lib/multi.c

index ff43378..d252351 100644 (file)
@@ -2079,14 +2079,14 @@ static CURLMcode add_next_timeout(struct timeval now,
       break;
     e = n;
   }
-  if(!list->size)  {
+  e = list->head;
+  if(!e) {
     /* clear the expire times within the handles that we remove from the
        splay tree */
     tv->tv_sec = 0;
     tv->tv_usec = 0;
   }
   else {
-    e = list->head;
     /* copy the first entry to 'tv' */
     memcpy(tv, e->ptr, sizeof(*tv));