From 0681f8c9070f3a40899d3040370e460c249a74bd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 12 Jul 2017 19:24:20 +0200 Subject: [PATCH] Shut up a memory leak warning --- src/libmain/stack.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libmain/stack.cc b/src/libmain/stack.cc index 57b6a197c..ab3baf62c 100644 --- a/src/libmain/stack.cc +++ b/src/libmain/stack.cc @@ -52,7 +52,8 @@ void detectStackOverflow() delivered when we're out of stack space. */ stack_t stack; stack.ss_size = 4096 * 4 + MINSIGSTKSZ; - stack.ss_sp = new char[stack.ss_size]; + static auto stackBuf = std::make_unique>(stack.ss_size); + stack.ss_sp = stackBuf->data(); if (!stack.ss_sp) throw Error("cannot allocate alternative stack"); stack.ss_flags = 0; if (sigaltstack(&stack, 0) == -1) throw SysError("cannot set alternative stack");