Commit 6a08886a authored by Robert Frohl's avatar Robert Frohl
Browse files

[FIX] memory leak from calculateMapping()

parent 001eb64e
......@@ -31,7 +31,7 @@
#include "WHistogram.h"
WHistogram::WHistogram( boost::shared_ptr< WValueSetBase > valueSet ) //, unsigned int nBuckets )
WHistogram::WHistogram( boost::shared_ptr< WValueSetBase > valueSet )
{
// calculate min max
m_minimum = wlimits::MAX_DOUBLE;
......@@ -137,7 +137,8 @@ void WHistogram::calculateMapping( double intervalSize )
unsigned int* mappedBuckets = new unsigned int[m_nMappedBuckets];
memset( mappedBuckets, 0, m_nMappedBuckets * sizeof( unsigned int ) );
//*mappedBuckets = { 0 }; // works with C++0x
m_mappedBuckets.swap( *new boost::scoped_array<unsigned int>( mappedBuckets ) );
boost::scoped_array<unsigned int> scoped( mappedBuckets );
m_mappedBuckets.swap( scoped );
unsigned int index = 0;
for( unsigned int i = 0; i != m_nInitialBuckets; ++i )
{
......
......@@ -120,7 +120,7 @@ class WHistogram
* \param valueSet source of the data for the histogram
* \param nBuckets number of buckets this histogram should display
**/
explicit WHistogram( boost::shared_ptr< WValueSetBase > valueSet ); //, unsigned int nBuckets = 1000 );
explicit WHistogram( boost::shared_ptr< WValueSetBase > valueSet );
/**
* Copy constructor. If another interval size is given setInterval() is called and a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment