指针使用越界:
1、free(): invalid next size (fast): 0x0000000001d294d0 ***
使用malloc方法动态分配指针指向的空间,实际在使用时超出了声明的空间,因此指针被污染了。出错代码如下:
struct TreeNode*** temp=(struct TreeNode ***)malloc(sizeof(struct TreeNode**)*depth);//动态分配depth行的数组
for(i=0;i<depth;i++)
{
temp[i+1]=(struct TreeNode **)malloc(sizeof(struct TreeNode*)*tempLen);
//实际使用时未考虑到temp指针的边界,当i=depth-1时此处越界了,因此temp指针被污染
}