]> git.ipfire.org Git - people/ms/dnsmasq.git/commitdiff
Grow pollfds array exponentially.
authorSimon Kelley <simon@thekelleys.org.uk>
Mon, 13 Jul 2015 11:47:52 +0000 (12:47 +0100)
committerSimon Kelley <simon@thekelleys.org.uk>
Mon, 13 Jul 2015 11:47:52 +0000 (12:47 +0100)
src/poll.c

index 01b356421c6b41323b2618fb7a7871abba1b0bee..d71b1b93e643917d3e6ca0afb5d5465380a165ff 100644 (file)
@@ -102,8 +102,9 @@ void poll_listen(int fd, short event)
         {
           /* Array too small, extend. */
           struct pollfd *new;
-          arrsize += 64;
-          
+
+          arrsize = (arrsize == 0) ? 64 : arrsize * 2;
+
           if (!(new = whine_malloc(arrsize * sizeof(struct pollfd))))
             return;