VTV를 MSVC와 함께 사용하고 있으며 데이터를로드 할 때 이상한 동작이 발생합니다. 나는 그것으로 조금만 손을 뻗어서 심지어 다음 코드가 힙 손상을 일으키고, 어떤 아이디어가 일어나고 있는지 또는 무엇이 잘못되었을 지 모르는가?strdup로 인한 힙 손상
> msvcr90d.dll!_CrtIsValidHeapPointer(const void * pUserData=0x00691da0) Zeile 2103 C++
msvcr90d.dll!_free_dbg_nolock(void * pUserData=0x00691da0, int nBlockUse=1) Zeile 1317 + 0x9 Bytes C++
msvcr90d.dll!_free_dbg(void * pUserData=0x00691da0, int nBlockUse=1) Zeile 1258 + 0xd Bytes C++
msvcr90d.dll!free(void * pUserData=0x00691da0) Zeile 49 + 0xb Bytes C++
Simulator.exe!vtkDataReader::ReadArray(const char * dataType=0x0370b734, int numTuples=24576, int numComp=3) Zeile 1401 + 0xc Bytes C++
Simulator.exe!vtkDataReader::ReadPoints(vtkPointSet * ps=0x081702d0, int numPts=24576) Zeile 1936 + 0x15 Bytes C++
편집 :
잘 작동에서는 StrDup 어떻게 든 MSVC에 깨진 대신에서는 StrDup의이 코드를 사용
vtkAbstractArray *vtkDataReader::ReadArray(const char *dataType, int numTuples, int numComp)
{
char* type=strdup(dataType);
free(type); // <--- here the heap corrution appears
...
이 호출 스택 무엇입니까? 같은
char *type=(char*)malloc(100);
strcpy(type,dataType);
여기에 더 많은 컨텍스트가 필요하며 dataType으로 무엇을 전달합니까? 'strdup'와'free' 호출 사이에 어떤 작업을하고 있습니까? – slugonamission
'strdup'과'free' 사이에서 당신은 무엇을하고 있습니까? 아마도 어딘가에서 중복 된 문자열의 끝을 넘어 쓸 것입니다. –
dataType은 내용이 "float"이고 strdup와 free 사이에 연산이없는 char입니다. – Dirk