From: Remi Gacogne Date: Tue, 5 Jan 2016 18:01:01 +0000 (+0100) Subject: Make sure the DelayPipe thread is the last member initialized X-Git-Tag: dnsdist-1.0.0-alpha2~122^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c8244caae9ee292bf66aec2745ed7d5d269aafe;p=pdns Make sure the DelayPipe thread is the last member initialized Otherwise the new thread might start running and access uninitialized members like d_pipe or d_work. On my host, running dnsdist in gdb without this modification results in a SIGSEGV at delaypipe.cc:141. --- diff --git a/pdns/delaypipe.hh b/pdns/delaypipe.hh index 68e6265be..7f7e02a38 100644 --- a/pdns/delaypipe.hh +++ b/pdns/delaypipe.hh @@ -38,7 +38,6 @@ public: void submit(T& t, int msec); //!< don't try for more than 4294 msec private: - std::thread d_thread; void worker(); struct Combo { @@ -60,6 +59,7 @@ private: }; std::multimap d_work; void gettime(struct timespec* ts); + std::thread d_thread; }; #include "delaypipe.cc"