One immediately obvious glaring problem: you really don't want to do this:
deleteInst(track, &head);
track = track->prev;
The instant you free that node, you lose the right to access its members. Save it first then recover after the delete:
node *save_prev = track->prev;
deleteInst(track, &head);
track = save_prev;
Another thing I'd check is that the list structure is correct, with something like (only during debug):
static void checkList (node *curr) {
int count = 0;
// PreCon: head->prev must be null.
if (curr != NULL) {
if (curr->prev != NULL) {
puts ("Linked list structure error A!");
exit (1);
}
}
// Check all nodes.
while (curr != NULL) {
// PreCon: curr->prev->next must be curr.
if (curr->prev != NULL) {
if (curr->prev->next != curr) {
puts ("Linked list structure error B!");
exit (1);
}
}
// PreCon: curr->next->prev must be curr.
if (curr->next != NULL) {
if (curr->next->prev != curr) {
puts ("Linked list structure error C!");
exit (1);
}
}
// Move to next and keep count.
curr = curr->next;
count++;
}
// All okay, output success message with size.
printf ("Linked list structure okay, size = %d\n", count);
}
Calling that with checkList (head) will validate that your linked list meets all the validity preconditions, on the off-chance that you may have buggy code elsewhere, such as when creating the list in ReadNodeList().
Beyond that, I suggest single stepping the code in your IDE or debugger after ReadNodeList() to see what it's actually doing. And, if you don't have an IDE/debugger, pepper your source code with lots of lines like:
printf ("DEBUG %d: track = %p\n", __LINE__, track);
and then examine the output of the debug statements to analyse the flow through your program.
Now, if you were to actually do that debugging exercise, it may surprise you to find out that deleteInst never appears to be called, because i seems to be always set to 0.
And the fault of that little problem lies here:
while (track != NULL) {
int i = 0; // <<<<<<<
//delete every other node
if (i%2 == 1) {
deleteInst (track, &head);
}
i++;
track = track->prev;
}
Yes, that's right, you are setting i to 0 every single time through the loop, hence i % 2 will never be equal to 1. You need to initialise i before the loop (and with the undefined behaviour of accessing freed memory removed as well):
int i = 0;
while (track != NULL) {
node *save_prev = track->prev;
//delete every other node
if (i%2 == 1)
deleteInst (track, &head);
i++;
track = save_prev;
}