]> granicus.if.org Git - pdns/commitdiff
Zero out qtype response numbers in our statistics
authorbert hubert <bert.hubert@powerdns.com>
Tue, 8 Jan 2019 13:17:40 +0000 (14:17 +0100)
committerbert hubert <bert.hubert@powerdns.com>
Tue, 8 Jan 2019 13:17:40 +0000 (14:17 +0100)
Although you might think otherwise, and I frequently do, atomic counters do not get zero-initialized.
With this PR, we do this by hand. This makes valgrind usable again on auth.

pdns/responsestats.cc

index c98db9ad4edb1658ccb46c0ff0b62c6c9953cb6f..64ec3abe457410568d1d6fb3206ddac500a8b231 100644 (file)
@@ -19,6 +19,8 @@ ResponseStats::ResponseStats() :   d_qtypecounters(new std::atomic<unsigned long
   for(int n=200; n < 65000 ; n+=200)
     d_sizecounters.push_back(make_pair(n,0));
   d_sizecounters.push_back(make_pair(std::numeric_limits<uint16_t>::max(),0));
+  for(unsigned int n =0 ; n < 65535; ++n)
+    d_qtypecounters[n] = 0;
 }
 
 ResponseStats g_rs;