Coverity: Forward NULL: CID 51
authorNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 20 Jan 2012 17:33:00 +0000 (12:33 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 20 Jan 2012 17:33:00 +0000 (12:33 -0500)
* src/ui/X11/event-Xt.c (Xt_timeout_callback): Make sure possible
NULL are not dereference, even in fatal crash scenario.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/ui/X11/event-Xt.c

index 236ecce..3dce06b 100644 (file)
@@ -2242,14 +2242,17 @@ static void Xt_timeout_callback(XtPointer closure, XtIntervalId * id)
        struct Xt_timeout *t2 = pending_timeouts;
 
        /* Remove this one from the set of pending timeouts */
-       if (t2 == timeout) {
+       if(timeout == NULL) {
+               abort();
+       } if (t2 == timeout) {
                pending_timeouts = pending_timeouts->next;
        } else {
                while (t2->next && t2->next != timeout) {
                        t2 = t2->next;
                }
                assert(t2->next);
-               t2->next = t2->next->next;
+               if(t2->next)
+                       t2->next = t2->next->next;
        }
        /* Add this one to the queue of completed timeouts */
        timeout->next = NULL;