_BLOCK_TYPE_IS_VALID(pHead-> nBlockUse)错误

时间:2016-01-11 12:53:20

标签: c++ arrays delete-operator

我遇到了错误" _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

1 个答案:

答案 0 :(得分:3)

app.config(function($stateProvider, $urlRouterProvider) { $urlRouterProvider.otherwise('/'); $stateProvider .state('profile', { abstract: true, url: '', templateUrl: domain + "/profile/master", controller: 'profileController' }) .state('profile.user', { url: '/user/:id', templateUrl: domain + '/angular/profile/:id', controller: 'privateProfileController' }); }); 更改指针。您需要记住最初分配的指针,用它来调用tempSpace++;