Skip to content

Commit a23cc9d

Browse files
committed
Fix memory leak on Spike Detector
1 parent 0d9e944 commit a23cc9d

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Source/Processors/SpikeDetector/SpikeDetector.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ bool SpikeDetector::addElectrode(int nChans, int electrodeID)
144144
newElectrode->numChannels = nChans;
145145
newElectrode->prePeakSamples = 8;
146146
newElectrode->postPeakSamples = 32;
147-
newElectrode->thresholds = new double[nChans];
148-
newElectrode->isActive = new bool[nChans];
149-
newElectrode->channels = new int[nChans];
147+
newElectrode->thresholds.malloc(nChans);
148+
newElectrode->isActive.malloc(nChans);
149+
newElectrode->channels.malloc(nChans);
150150
newElectrode->isMonitored = false;
151151

152152
for (int i = 0; i < nChans; i++)

Source/Processors/SpikeDetector/SpikeDetector.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ struct SimpleElectrode
4343
int electrodeID;
4444
int sourceNodeId;
4545

46-
int* channels;
47-
double* thresholds;
48-
bool* isActive;
46+
HeapBlock<int> channels;
47+
HeapBlock<double> thresholds;
48+
HeapBlock<bool> isActive;
4949

5050
};
5151

0 commit comments

Comments
 (0)