fix a leak in StdDev

This commit is contained in:
Stephen Birarda 2014-11-07 17:11:00 -08:00
parent c04e653cf3
commit 4fd22914c0
2 changed files with 9 additions and 6 deletions

View file

@ -13,14 +13,15 @@
#include <cmath>
#include "StdDev.h"
const int NUM_SAMPLES = 1000;
StDev::StDev() {
_data = new float[NUM_SAMPLES];
_sampleCount = 0;
StDev::StDev() :
_data(),
_sampleCount(0)
{
reset();
}
void StDev::reset() {
memset(&_data, 0, sizeof(_data));
_sampleCount = 0;
}

View file

@ -12,6 +12,8 @@
#ifndef hifi_StdDev_h
#define hifi_StdDev_h
const int NUM_SAMPLES = 1000;
class StDev {
public:
StDev();
@ -21,7 +23,7 @@ public:
float getStDev() const;
int getSamples() const { return _sampleCount; }
private:
float* _data;
float _data[NUM_SAMPLES];
int _sampleCount;
};