Deallocating a dynamically allocated array of data must be done with delete[] instead of delete
This commit is contained in:
parent
bef4835ca2
commit
24fe5cb6a0
|
@ -53,7 +53,7 @@ public:
|
||||||
bool * newdataLoc = new bool[ sz ];
|
bool * newdataLoc = new bool[ sz ];
|
||||||
if(datasize!=0) memcpy(newdataLoc,data,sizeof(datasize));
|
if(datasize!=0) memcpy(newdataLoc,data,sizeof(datasize));
|
||||||
std::swap(data,newdataLoc);
|
std::swap(data,newdataLoc);
|
||||||
if(newdataLoc != 0) delete newdataLoc;
|
if(newdataLoc != 0) delete[] newdataLoc;
|
||||||
datareserve = sz;
|
datareserve = sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue