I am recieving this error when I attempt to run this program:
* glibc detected * ./a.out: double free or corruption (fasttop): 0x0000000001926070 ***
I attempted to create my own pop function in C and it is giving me the error above. I'm not sure where I went wrong.
struct node *pop(struct node *top, int *i)
{
struct node *new_node = top;
int count = 0;
if ( new_node == NULL) {
return top;
}
while ( new_node != NULL && (count < 1)) {
*i = new_node->value;
free(new_node);
new_node = new_node->next;
count++;
}
return new_node;
}
top
. 2)free(new_node); new_node = new_node->next;
: Do not use after release. – BLUEPIXY