Skip to content

Commit

Permalink
attempt to fix fcwt related memory leaks discovered by valgrind
Browse files Browse the repository at this point in the history
  • Loading branch information
lschneiderbauer committed Jan 5, 2025
1 parent 78f3cbd commit 3563dc0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/fcwt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,12 @@ void FCWT::convolve(fftwf_plan p, fftwf_complex *Ihat, fftwf_complex *O1, comple
fftbased(p, Ihat, O1, (float*)lastscalemem, wav->mother, newsize, scale, wav->imag_frequency, wav->doublesided);
if(use_normalization) fft_normalize((complex<float>*)lastscalemem, newsize);
memcpy(out, (complex<float>*)lastscalemem, sizeof(complex<float>)*size);

#ifdef _WIN32
_aligned_free(lastscalemem);
#else
free(lastscalemem);
#endif
} else {
// if(!out) {
// std::cout << "OUT NOT A POINTER" << std::endl;
Expand Down
1 change: 1 addition & 0 deletions src/fcwt.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class Morlet : public Wavelet {
class Scales {
public:
FCWT_LIBRARY_API Scales(Wavelet *pwav, SCALETYPE st, int fs, float f0, float f1, int fn);
~Scales() { free(scales); };

// void FCWT_LIBRARY_API getScales(float *pfreqs, int pnf);
// void FCWT_LIBRARY_API getFrequencies(float *pfreqs, int pnf);
Expand Down

0 comments on commit 3563dc0

Please sign in to comment.