diff --git a/lib/arch/CArchNetworkBSD.cpp b/lib/arch/CArchNetworkBSD.cpp index 9b6eec6d..1db5df82 100644 --- a/lib/arch/CArchNetworkBSD.cpp +++ b/lib/arch/CArchNetworkBSD.cpp @@ -274,7 +274,8 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout) } // allocate space for translated query - struct pollfd* pfd = new struct pollfd[num]; + struct pollfd* pfd = reinterpret_cast( + alloca(num * sizeof(struct pollfd))); // translate query for (int i = 0; i < num; ++i) { @@ -298,7 +299,6 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout) ARCH->testCancelThread(); continue; } - delete[] pfd; throwError(errno); } } while (false); @@ -320,9 +320,6 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout) } } - // done with translated query - delete[] pfd; - return n; }