don't free nodes too early
This commit is contained in:
parent
cf1df4e226
commit
a6ee682ae8
1 changed files with 11 additions and 1 deletions
12
main.c
12
main.c
|
@ -162,6 +162,16 @@ static void print_crc(ulong remainder)
|
|||
printf("%08X\n", (int) remainder);
|
||||
}
|
||||
|
||||
static void free_nodes(string_node *n)
|
||||
{
|
||||
string_node *next;
|
||||
while (n) {
|
||||
next = n->next;
|
||||
free(n);
|
||||
n = next;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
string_node *n;
|
||||
|
@ -175,7 +185,7 @@ int main(int argc, char **argv)
|
|||
FILE *stream = open_stream(n->s);
|
||||
print_crc(cycle_file(stream));
|
||||
fclose(stream);
|
||||
free(n);
|
||||
}
|
||||
free_nodes(input_node);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue