c – double free or corruption (fasttop)

c – double free or corruption (fasttop)

The problem is here:

        temp2=first;

Basically, when you free temp2, you free first, not the memory allocated here:

        temp2=(NODE *)malloc(sizeof(NODE));

, which remains a memory leak, because after the assignment it cant be freed anymore.

Also, your code has probably some more problems (one is that you shouldnt use fflush on an input stream), but without some more details, its impossible to tell.

c – double free or corruption (fasttop)

Leave a Reply

Your email address will not be published.