]> git.meshlink.io Git - meshlink/commitdiff
Fix a potential crash when restarting the mesh.
authorGuus Sliepen <guus@meshlink.io>
Thu, 5 Sep 2019 15:55:41 +0000 (17:55 +0200)
committerGuus Sliepen <guus@meshlink.io>
Thu, 5 Sep 2019 18:00:11 +0000 (20:00 +0200)
The tv value must not be changed for a timeout that is still linked into the
tree of timeouts, otherwise the tree can get corrupted.

src/event.c

index 61e6d8d7365893f53fffe50c4c6e07ee3b46ca22..b58c6b6bc11e81ffd6cf03d045a254857542ebe8 100644 (file)
@@ -108,15 +108,8 @@ void io_del(event_loop_t *loop, io_t *io) {
 }
 
 void timeout_add(event_loop_t *loop, timeout_t *timeout, timeout_cb_t cb, void *data, struct timeval *tv) {
-       if(!timeout->cb)
-               timeout->tv = (struct timeval) {
-               0, 0
-       };
-
        timeout->cb = cb;
-
        timeout->data = data;
-
        timeout->node.data = timeout;
 
        timeout_set(loop, timeout, tv);