delete [] itemName;
nsCRT::free(itemName);
int FilesTest::IterateDirectoryChildren(nsFileSpec& startChild)//----------------------------------------------------------------------------------------{    // - Test of directory iterator    nsFileSpec grandparent;    startChild.GetParent(grandparent); // should be the original default directory.    nsFilePath grandparentPath(grandparent);        mConsole << "Forwards listing of " << (const char*)grandparentPath << ":" << nsEndl;    for (nsDirectoryIterator i(grandparent, +1); i.Exists(); i++)    {        char* itemName = ((nsFileSpec&)i).GetLeafName();        mConsole << '\t' << itemName << nsEndl;        delete [] itemName;    }    mConsole << "Backwards listing of " << (const char*)grandparentPath << ":" << nsEndl;    for (nsDirectoryIterator j(grandparent, -1); j.Exists(); j--)    {        char* itemName = ((nsFileSpec&)j).GetLeafName();        mConsole << '\t' << itemName << nsEndl;        delete [] itemName;    }    Inspect();    return 0;}