aboutsummaryrefslogtreecommitdiffstats
path: root/main/varnish/fix-stack-overflow.patch
blob: f516fdd429affa7ec0263119ae7e8bdb88a1da13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- ./bin/varnishd/waiter/cache_waiter_epoll.c.orig
+++ ./bin/varnishd/waiter/cache_waiter_epoll.c
@@ -70,7 +70,7 @@
 static void *
 vwe_thread(void *priv)
 {
-	struct epoll_event ev[NEEV], *ep;
+	struct epoll_event *ev, *ep;
 	struct waited *wp;
 	struct waiter *w;
 	double now, then;
@@ -82,6 +82,8 @@
 	w = vwe->waiter;
 	CHECK_OBJ_NOTNULL(w, WAITER_MAGIC);
 	THR_SetName("cache-epoll");
+	ev = calloc(NEEV, sizeof(struct epoll_event));
+	assert(ev != NULL);
 
 	now = VTIM_real();
 	while (1) {
@@ -149,6 +151,7 @@
 	closefd(&vwe->pipe[0]);
 	closefd(&vwe->pipe[1]);
 	closefd(&vwe->epfd);
+	free(ev);
 	return (NULL);
 }