简体   繁体   中英

_BLOCK_TYPE_IS_VALID(pHead->nBlockUse) Error

I encoutered an error "_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)" at the last line of the code below:

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;

Why I get such an error? Since I have copy those pointer value to file->cam1cam2ThreeDPoints , I should be able to delete tempSpace .

tempSpace++; changes the pointer. You need to remember the originally allocated pointer for calling delete with it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM