From d3708c5e66674a536b0bfc2d83d452d0db589bde Mon Sep 17 00:00:00 2001 From: Hiroki Noda Date: Thu, 22 Mar 2018 05:14:10 +0900 Subject: [PATCH] Fix: leak fd --- source/eventcore/drivers/posix/sockets.d | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/eventcore/drivers/posix/sockets.d b/source/eventcore/drivers/posix/sockets.d index ec4592e..dd9e00a 100644 --- a/source/eventcore/drivers/posix/sockets.d +++ b/source/eventcore/drivers/posix/sockets.d @@ -960,13 +960,14 @@ private int getBacklogSize() int backlog = 128; version(linux) { - import core.stdc.stdio : fopen, fscanf; + import core.stdc.stdio : fclose, fopen, fscanf; auto somaxconn = fopen("/proc/sys/net/core/somaxconn", "re"); if(somaxconn) { int tmp; if (fscanf(somaxconn, "%d", &tmp) == 1) backlog = tmp; + fclose(somaxconn); } } return backlog;