Skip to content

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

C

Correct delete[] use (#629)

Campbell Barton87094dbf7a3c
diff --git a/toonz/sources/common/trop/tresample.cpp b/toonz/sources/common/trop/tresample.cpp
index d79a18013..6322886a0 100644
--- a/toonz/sources/common/trop/tresample.cpp
+++ b/toonz/sources/common/trop/tresample.cpp
@@ -1972,8 +1972,8 @@ TCALLOC (colval, lu);*/
yhi_ += aff.a21;
}
}
- delete colval;
- delete colheight;
+ delete[] colval;
+ delete[] colheight;
topy = 0;
/*TCALLOC (nocheight, lx);*/
@@ -2181,8 +2181,8 @@ TCALLOC (colval, lu);*/
yhi_ += aff.a21;
}
}
- delete colval;
- delete colheight;
+ delete[] colval;
+ delete[] colheight;
topy = 0;
/*TCALLOC (nocheight, lx);*/
@@ -2589,7 +2589,7 @@ void rop_resample_rgbm(TRasterPT<T> rout, const TRasterPT<T> &rin,
static void free_filter(FILTER *filter, int lx) {
for (--lx; lx >= 0; lx--)
if (filter[lx].w_base) delete (filter[lx].w_base);
- delete (filter);
+ delete[] filter;
}
//-----------------------------------------------------------------------------
@@ -2772,9 +2772,9 @@ void do_resample(TRasterGR8P rout, const TRaster32P &rin, const TAffine &aff,
rown, nocdiamx, coln, nocdiamy);
// free_nocalc (coln);
- if (coln) delete (coln);
+ if (coln) delete[] coln;
// free_nocalc (rown);
- if (rown) delete (rown);
+ if (rown) delete[] rown;
free_filter(colf, rout->getLy());
free_filter(rowf, rout->getLx());
//----NON GESTIAMO ANCORA EXTRA BUFFER
diff --git a/toonz/sources/image/pli/pli_io.cpp b/toonz/sources/image/pli/pli_io.cpp
index e7c786740..d6f97f8ad 100644
--- a/toonz/sources/image/pli/pli_io.cpp
+++ b/toonz/sources/image/pli/pli_io.cpp
@@ -1099,7 +1099,7 @@ PliTag *ParsedPliImp::readPaletteTag() {
PaletteTag *tag = new PaletteTag(numColors, plt);
- delete plt;
+ delete[] plt;
return tag;
}
@@ -1121,7 +1121,7 @@ PliTag *ParsedPliImp::readPaletteWithAlphaTag() {
PaletteWithAlphaTag *tag = new PaletteWithAlphaTag(numColors, plt);
- delete plt;
+ delete[] plt;
return tag;
}
@@ -2143,7 +2143,7 @@ TUINT32 ParsedPliImp::writeImageTag(ImageTag *tag) {
for (i = 0; i < tag->m_numObjects; i++) writeDinamicData(objectOffset[i]);
- delete objectOffset;
+ delete[] objectOffset;
return offset;
}
diff --git a/toonz/sources/stdfx/pins.cpp b/toonz/sources/stdfx/pins.cpp
index ec6b39e9d..788e6d9bb 100644
--- a/toonz/sources/stdfx/pins.cpp
+++ b/toonz/sources/stdfx/pins.cpp
@@ -482,7 +482,7 @@ int splitMatrix(double **a, int n, int *index) {
for (i = j + 1; i < n; i++) a[i][j] *= dum;
}
}
- delete vv;
+ delete[] vv;
return 0;
}