From: Simon Kelley Date: Mon, 13 Jul 2015 11:47:52 +0000 (+0100) Subject: Grow pollfds array exponentially. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=90c3822bfacab24e3e2a082685dadb7d671f9059;p=people%2Fms%2Fdnsmasq.git Grow pollfds array exponentially. --- diff --git a/src/poll.c b/src/poll.c index 01b3564..d71b1b9 100644 --- a/src/poll.c +++ b/src/poll.c @@ -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;