_BLOCK_TYPE_IS_VALID(pHead->nBlockUse) 错误

_BLOCK_TYPE_IS_VALID(pHead->nBlockUse) Error

我在下面代码的最后一行遇到错误“_BLOCK_TYPE_IS_VALID(pHead->nBlockUse):

pixelCoorindateAndThreePoint* tempSpace = new pixelCoorindateAndThreePoint[possibleMaxSize];
while (sscanf(temp, "%f %f", &cam1x, &cam1y)){
    location = (int)(file->length*cam1y + cam1x);
    file->cam1cam2ThreeDPoints[(int)(file->length*cam1y + cam1x)] = new pixelCoorindateAndThreePoint;
        sscanf(temp, "%*f %*f %f %f %f %f %f \n",
            &(tempSpace->PixelCoordinateCam2.x),
            &(tempSpace->PixelCoordinateCam2.y),
            &(tempSpace->threePoints.x),
            &(tempSpace->threePoints.y),
            &(tempSpace->threePoints.z));

        file->cam1cam2ThreeDPoints[location] = tempSpace;
        tempSpace++;

    temp = strtok(NULL, "\n");
}
    delete[] tempSpace;

为什么会出现这样的错误?因为我已经将那些指针值复制到 file->cam1cam2ThreeDPoints,所以我应该能够删除 tempSpace.

tempSpace++; 更改指针。您需要记住最初分配的指针,以便用它调用 delete