From: Kees Monshouwer Date: Mon, 26 Aug 2013 21:26:43 +0000 (+0200) Subject: fix ringbuffer size decrease X-Git-Tag: rec-3.6.0-rc1~476^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=975bee12a871a4f09def1b7c9069d5ae1f766d2c;p=pdns fix ringbuffer size decrease --- diff --git a/pdns/statbag.cc b/pdns/statbag.cc index 83421ff75..430c04829 100644 --- a/pdns/statbag.cc +++ b/pdns/statbag.cc @@ -189,26 +189,28 @@ void StatRing::resize(unsigned int newsize) return; Lock l(d_lock); - if(newsize>d_size) { - d_size=newsize; - d_items.resize(d_size); - return; - } - // this is the hard part, shrink - int startpos=d_pos-newsize; - int rpos; - vectornewring; - for(unsigned int i=startpos;inewsize) + startpos=d_pos-newsize; + + vectornewring; + for(unsigned int i=startpos;id_size) { + d_size=newsize; + d_items.resize(d_size); + } } + StatRing::~StatRing() { // do not clean up d_lock, it is shared