There are several problems in the code. Most are the same issue - a lack of understanding of what free() does.
Let's say that some code allocates memory to a pointer, and that memory is 'shared' like this:
node *mynode = malloc(sizeof(node));
node *yournode = mynode;
Both pointers will contain the same address, pointing at the same memory. Change the ...
The IDE isn't able to recognize the card.raw file as something that can be opened as any particular file type. When I double-click on it, the IDE hangs, as you experienced. My browser didn't crash (Firefox), it gave me a popup error message after it timed out. Yours may have actually crashed, I can't explain that.
However, if you right click on the file ...