Tag: 双免费

双重免费或腐败(fasttop)

我的代码的以下部分在执行* glibc检测时给出了这个消息./a.out:double free或corruption(fasttop):0x08e065d0 * * 我已经多次通过代码,但我不能清楚看到我如何滥用free (temp2) bool found= false; int x=0; for ( x=0; x<=312500; x++) { while (count num); temp->ptr=NULL; newNode = (NODE *)malloc(sizeof(NODE)); newNode->num=temp->num; newNode->ptr=NULL; if (first != NULL) { temp2=(NODE *)malloc(sizeof(NODE)); temp2=first; while (temp2 != NULL && !found) { if (temp2->num == newNode->num) {found=true;} temp2= temp2->ptr; } free(temp2); if (!found) { […]