From b61479939b23a668e53d70ebe14f55152ff9cca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Wei=C3=9F?= Date: Fri, 28 Apr 2017 15:47:07 +0100 Subject: [PATCH] initialise memory correctly --- Sources/Selector.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Selector.swift b/Sources/Selector.swift index 38c8a9e4a..f9d6ce10f 100644 --- a/Sources/Selector.swift +++ b/Sources/Selector.swift @@ -38,14 +38,14 @@ public class Selector { guard fd >= 0 else { throw IOError(errno: errno, reason: "Creation of epoll failed") } - events = UnsafeMutablePointer.allocate(capacity: 2048) // max 2048 events per epoll_wait #else fd = Darwin.kqueue() guard fd >= 0 else { throw IOError(errno: errno, reason: "Creation of kqueue failed") } - events = UnsafeMutablePointer.allocate(capacity: 2048) // max 2048 events per kevent(...) call #endif + events = UnsafeMutablePointer.allocate(capacity: 2048) // max 2048 events per epoll/kqueue call + events.initialize(to: kevent()) } deinit {