getAttribute() Causing heap corruption I think? Whats wrong?

Using the colladaDOM to load .dae into directx format.

Heres one of my functions, it is simple, takes in a node, gets a list of its children, and loops through them, in each loop it will make a string type variable and call the getAttribute(“sid”) to fill it out and then depending on what the string is, it will put some data in the array of a D3DXMATRIX.

The function just fills out a matrix from the collada file.

So it works perfect up to when it finishes it’s first pass through the loop, and it is deallocating the string, debug assertion error. Allocating it works fine though.

Don’t know if this has anything to do with it, but I’m using visual studio 11 dev preview, and using compiler vs100 (vs10’s compiler and files) settings.

dbgheap.c Line:1322

Expression: _CrtISValidHeapPointer(pUserData)

D3DXMATRIX ColladaFileLoader::processMatrix(daeElement* node)
{
D3DXMATRIX matWorld;

daeTArray<daeElementRef> nodeChildren = node->getChildren();

for (int i = 0; i < nodeChildren.getCount(); i++)
{
string type = nodeChildren[i]->getAttribute(“sid”);

if (type == "rotationX")
{
    string data = nodeChildren[i]-&gt;getCharData();
    stringstream stm(data);

    stm &gt;&gt; matWorld.m[0][0];
    stm &gt;&gt; matWorld.m[0][1];
    stm &gt;&gt; matWorld.m[0][2];
    stm &gt;&gt; matWorld.m[0][3];
}


if (type == "rotationY")
{
    string data = nodeChildren[i]-&gt;getCharData();
    stringstream stm(data);

    stm &gt;&gt; matWorld.m[1][0];
    stm &gt;&gt; matWorld.m[1][1];
    stm &gt;&gt; matWorld.m[1][2];
    stm &gt;&gt; matWorld.m[1][3];
}

if (type == "rotationZ")
{
    string data = nodeChildren[i]-&gt;getCharData();
    stringstream stm(data);

    stm &gt;&gt; matWorld.m[2][0];
    stm &gt;&gt; matWorld.m[2][1];
    stm &gt;&gt; matWorld.m[2][2];
    stm &gt;&gt; matWorld.m[2][3];
}


if (type == "location")
{
    string data = nodeChildren[i]-&gt;getCharData();
    stringstream stm(data);

    stm &gt;&gt; matWorld.m[3][0];
    stm &gt;&gt; matWorld.m[3][1];
    stm &gt;&gt; matWorld.m[3][2];
    matWorld.m[3][3] = 1;
}

}

return matWorld;
}

Ok found the problem after nearly a week of beating my head against the wall, for others who may have run into this issue in the future I’ll post the solution.

The version of colladaDOM I used was compiled with /mDd library (multi-threaded debug dll) while my project was using /mtd (multi threaded debug static) settings. After changing my project to /MDd all my problems vanished.

Another possible solution would be to rebuild DOM with /mtd to match the project settings.