diff --git a/lib/jkqtcommon/jkqtpbasicimagetools.h b/lib/jkqtcommon/jkqtpbasicimagetools.h index 9911d2831c..2125c38aa7 100644 --- a/lib/jkqtcommon/jkqtpbasicimagetools.h +++ b/lib/jkqtcommon/jkqtpbasicimagetools.h @@ -28,6 +28,7 @@ #include #include #include +#include #include "jkqtcommon/jkqtcommon_imexport.h" #include "jkqtcommon/jkqtpmathtools.h" @@ -654,17 +655,17 @@ inline void JKQTPImagePlot_array2RGBimage(const T* dbl_in, int width, int height const T* dbl=dbl_in; - T* dbllog=nullptr; + QVector dbllog; if (logScale) { double logB=log10(logBase); - dbllog=static_cast(malloc(static_cast(width)*static_cast(height)*sizeof(T))); + dbllog.resize(static_cast(width)*static_cast(height)); //memcpy(dbl, dbl_in, width*height*sizeof(T)); for (int i=0; i0) { p=static_cast(malloc(sizeof(JKQTPMathParser::jkmpNode*) * num)); for (int i=0; igetDatastore()->getColumnPointer(imageColumn,0); size_t imgSize=parent->getDatastore()->getRows(imageColumn); - bool* locData=static_cast(malloc(imgSize*sizeof(bool))); - this->data=locData; + QVector locData(imgSize,false); + this->data=locData.data(); this->Ny= static_cast(imgSize/this->Nx); for (size_t i=0; idata=nullptr; } bool JKQTPColumnOverlayImageEnhanced::usesColumn(int c) const diff --git a/lib/jkqtplotter/jkqtpdatastorage.cpp b/lib/jkqtplotter/jkqtpdatastorage.cpp index c0fb330610..992e8481ca 100644 --- a/lib/jkqtplotter/jkqtpdatastorage.cpp +++ b/lib/jkqtplotter/jkqtpdatastorage.cpp @@ -688,7 +688,7 @@ size_t JKQTPDatastore::copyColumn(size_t old_column, size_t start, size_t stride { JKQTPColumn old=columns[old_column]; size_t rows=old.getRows(); - double* d=static_cast(malloc(rows*sizeof(double))); + QVector d(rows, 0.0); double* dd=old.getPointer(0); size_t j=0; for (size_t i=start; i