Allocate float_buffer_ in the initializer list.

This may fix a Dr. Memory error: "allocated with operator new, freed
with operator delete[]". I suspect this is a false positive; in the
existing implementation the reset causes a delete[] on NULL. This is
a no-op of course, but Dr. Memory might be flagging it. We shall see.

In any case, this change is an improvement.

BUG=2321
TBR=bjornv

Review URL: https://webrtc-codereview.appspot.com/2215004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4748 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2013-09-14 01:57:55 +00:00
parent 8a1448950c
commit 15b8871e4a

View File

@ -18,14 +18,13 @@ namespace webrtc {
PushSincResampler::PushSincResampler(int source_frames, PushSincResampler::PushSincResampler(int source_frames,
int destination_frames) int destination_frames)
: resampler_(NULL), : resampler_(NULL),
float_buffer_(NULL), float_buffer_(new float[destination_frames]),
source_ptr_(NULL), source_ptr_(NULL),
destination_frames_(destination_frames), destination_frames_(destination_frames),
first_pass_(true), first_pass_(true),
source_available_(0) { source_available_(0) {
resampler_.reset(new SincResampler(source_frames * 1.0 / destination_frames, resampler_.reset(new SincResampler(source_frames * 1.0 / destination_frames,
source_frames, this)); source_frames, this));
float_buffer_.reset(new float[destination_frames]);
} }
PushSincResampler::~PushSincResampler() { PushSincResampler::~PushSincResampler() {