Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

failing at linked list / memory

Name: Anonymous 2010-04-29 9:36

http://codepad.org/QN4Noquq

Somebody please tell me what I am doing wrong here.  The problem is line 174, which is in list_delete():

free(temp->next);

In Windows the program just stops working correctly (or in this case just terminates since my testcase is very short). In GDB, it gives me the following output when I run the program:
warning: HEAP[list.exe]:
warning: Heap block at 00391060 modified at 0039106C past requested size of 4


I know it's that line because it's in the backtrace and I've stepped through that code many times.
I can't figure out what's wrong with freeing temp->next there.  If I print temp->next->data->name just before that line it gives me the expected string, so the memory has to be ok and I'm trying to delete the free the right struct.  I just don't understand what the problem is here.

Name: Anonymous 2010-04-29 15:37

>>6
On x86_64, you'd need 16bytes(sizeof(pointer*)*2)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List