Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Plug some memory leaks

Michał Janiszewski50e38f736bd8
diff --git a/toonz/sources/common/tparam/tparamset.cpp b/toonz/sources/common/tparam/tparamset.cpp
index 7fcfd9ccc..b488040fa 100644
--- a/toonz/sources/common/tparam/tparamset.cpp
+++ b/toonz/sources/common/tparam/tparamset.cpp
@@ -119,6 +119,7 @@ TParamSet::TParamSet(const TParamSet &src)
TParamSet::~TParamSet()
{
+ delete m_imp;
}
//---------------------------------------------------------
diff --git a/toonz/sources/common/trop/tblur.cpp b/toonz/sources/common/trop/tblur.cpp
index e256d7614..0a8f75428 100644
--- a/toonz/sources/common/trop/tblur.cpp
+++ b/toonz/sources/common/trop/tblur.cpp
@@ -826,6 +826,19 @@ void doBlurRgb(TRasterPT<T> &dstRas, TRasterPT<T> &srcRas, double blur, int dx,
if ((!fbuffer) || (!row1) || (!col1) || (!col2)) {
if (!useSSE)
r1->unlock();
+#ifdef _WIN32
+ if (useSSE) {
+ _aligned_free(col2);
+ _aligned_free(col1);
+ _aligned_free(row1);
+ _aligned_free(fbuffer);
+ } else
+#endif
+ {
+ delete[] col2;
+ delete[] col1;
+ delete[] row1;
+ }
return;
}
@@ -902,8 +915,12 @@ void doBlurGray(TRasterPT<T> &dstRas, TRasterPT<T> &srcRas, double blur, int dx,
col1 = new float[lly + 2 * brad];
col2 = new T[lly];
- if ((!fbuffer) || (!row1) || (!col1) || (!col2))
+ if ((!fbuffer) || (!row1) || (!col1) || (!col2)) {
+ delete[] row1;
+ delete[] col1;
+ delete[] col2;
return;
+ }
row2 = fbuffer;
diff --git a/toonz/sources/common/trop/tover.cpp b/toonz/sources/common/trop/tover.cpp
index 41dfb1277..384c40ae6 100644
--- a/toonz/sources/common/trop/tover.cpp
+++ b/toonz/sources/common/trop/tover.cpp
@@ -255,6 +255,7 @@ void do_over(TRasterGR8P rout, const TRaster32P &rup)
TPixel32 out32_pix = overPix(*temp_pix, *up_pix);
*out_pix = out_pix->from(out32_pix);
}
+ delete temp_pix;
}
}
diff --git a/toonz/sources/include/tparamset.h b/toonz/sources/include/tparamset.h
index 39380ad5d..de4238e50 100644
--- a/toonz/sources/include/tparamset.h
+++ b/toonz/sources/include/tparamset.h
@@ -104,7 +104,7 @@ public:
std::string getValueAlias(double frame, int precision);
private:
- TParamSetImp *m_imp;
+ TParamSetImp *m_imp = nullptr;
};
#ifdef _WIN32