diff --git a/toonz/sources/colorfx/regionstyles.cpp b/toonz/sources/colorfx/regionstyles.cpp index 2ba1944..fc33ff9 100644 --- a/toonz/sources/colorfx/regionstyles.cpp +++ b/toonz/sources/colorfx/regionstyles.cpp @@ -4447,7 +4447,7 @@ TMosaicFillStyle::TMosaicFillStyle(const TPixel32 &bgColor, const double maxThickness) : TSolidColorStyle(bgColor), m_size(size), m_deform(deform), m_minThickness(minThickness), m_maxThickness(maxThickness) { - for (int i = 0; i < 5; i++) + for (int i = 0; i < 4; i++) m_pointColor[i] = pointColor[i]; } diff --git a/toonz/sources/common/psdlib/psd.cpp b/toonz/sources/common/psdlib/psd.cpp index 0407bc9..b778bae 100644 --- a/toonz/sources/common/psdlib/psd.cpp +++ b/toonz/sources/common/psdlib/psd.cpp @@ -562,16 +562,20 @@ void TPSDReader::readImageData(TRasterP &rasP, TPSDLayerInfo *li, TPSDChannelInf if (!m_region.isEmpty()) { x0 = m_region.getP00().x; // se x0 è fuori dalle dimensioni dell'immagine ritorna un'immagine vuota - if (x0 >= m_headerInfo.cols) + if (x0 >= m_headerInfo.cols) { + free(rledata); return; + } x1 = x0 + m_region.getLx() - 1; // controllo che x1 rimanga all'interno dell'immagine if (x1 >= m_headerInfo.cols) x1 = m_headerInfo.cols - 1; y0 = m_region.getP00().y; // se y0 è fuori dalle dimensioni dell'immagine ritorna un'immagine vuota - if (y0 >= m_headerInfo.rows) + if (y0 >= m_headerInfo.rows) { + free(rledata); return; + } y1 = y0 + m_region.getLy() - 1; // controllo che y1 rimanga all'interno dell'immagine if (y1 >= m_headerInfo.rows) @@ -624,6 +628,7 @@ void TPSDReader::readImageData(TRasterP &rasP, TPSDLayerInfo *li, TPSDChannelInf layerSaveBox *= imageRect; if (layerSaveBox == TRect() || layerSaveBox.isEmpty()) { + free(rledata); return; } // Estraggo da rasP solo il rettangolo che si interseca con il livello corrente diff --git a/toonz/sources/common/tcore/tmathutil.cpp b/toonz/sources/common/tcore/tmathutil.cpp index 4f15e6b..bf6e807 100644 --- a/toonz/sources/common/tcore/tmathutil.cpp +++ b/toonz/sources/common/tcore/tmathutil.cpp @@ -44,7 +44,7 @@ inline int getEl(int i, int j, int n) typedef struct { int ord; - double coef[MAX_ORDER]; + double coef[MAX_ORDER + 1]; } poly; //------------------------------------------------------------------------- diff --git a/toonz/sources/common/tparam/tparamset.cpp b/toonz/sources/common/tparam/tparamset.cpp index 7fcfd9c..b488040 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 e256d76..0a8f754 100644 --- a/toonz/sources/common/trop/tblur.cpp +++ b/toonz/sources/common/trop/tblur.cpp @@ -826,6 +826,19 @@ void doBlurRgb(TRasterPT &dstRas, TRasterPT &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 &dstRas, TRasterPT &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 41dfb12..384c40a 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/common/tvrender/qtofflinegl.cpp b/toonz/sources/common/tvrender/qtofflinegl.cpp index 750802f..860e4c2 100644 --- a/toonz/sources/common/tvrender/qtofflinegl.cpp +++ b/toonz/sources/common/tvrender/qtofflinegl.cpp @@ -363,7 +363,7 @@ void QtOfflineGLPBuffer::getRaster(TRaster32P raster) pix->r = qRed(*inpPix); pix->g = qGreen(*inpPix); pix->b = qBlue(*inpPix); - *inpPix++; + inpPix++; } } raster->unlock(); diff --git a/toonz/sources/common/tvrender/tinbetween.cpp b/toonz/sources/common/tvrender/tinbetween.cpp index 7972d22..d6443ad 100644 --- a/toonz/sources/common/tvrender/tinbetween.cpp +++ b/toonz/sources/common/tvrender/tinbetween.cpp @@ -1290,7 +1290,7 @@ void TInbetween::Imp::computeTransformation() } } else { - assert(transform.m_scaleX = transform.m_scaleY); + assert(transform.m_scaleX == transform.m_scaleY); cs = transform.m_scaleX * cos(totalRadRotation); sn = transform.m_scaleX * sin(totalRadRotation); diff --git a/toonz/sources/common/tvrender/tstrokedeformations.cpp b/toonz/sources/common/tvrender/tstrokedeformations.cpp index 0a36b5a..8cee607 100644 --- a/toonz/sources/common/tvrender/tstrokedeformations.cpp +++ b/toonz/sources/common/tvrender/tstrokedeformations.cpp @@ -200,6 +200,7 @@ TStrokePointDeformation::TStrokePointDeformation(const TPointD &vect, double radius) : m_imp(new Imp(vect, center, radius)) { + delete m_imp; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/include/tparamset.h b/toonz/sources/include/tparamset.h index 39380ad..de4238e 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