I am using the new operator to create a dynamically allocated array (I am using this one because I want to save on the memory overhead of using a vector). The error occurs in the destructor, saying the pointer being freed was not allocated although obviously it was. The constructors and destructors are as follows:
~Path() {
printf("Path Destructor\n");
if(points) {
delete[] points;
}
}
Path(const std::vector<PathPoint>& points_) {
size = points_.size();
points = new PathPoint[size];
int i = 0;
for(const PathPoint& p : points_) {
points[i++] = p;
}
printf("Path created\n");
}