Commit 8ce552bd by Rudolf

Fix all memory leaks

Debugged via valgrind
The tree freeing was leftover from single-spaced binary tree.
parent 55b4562c
Showing with 6 additions and 9 deletions
......@@ -55,6 +55,8 @@ static int read_entry(struct BIT_BUFFER *bitbuf, struct tree *parent)
free(c);
}
free(bit);
return 0;
}
......
......@@ -11,18 +11,13 @@
void free_tree(struct tree *parent)
{
while (parent != NULL) {
struct tree *left, *right;
if (parent == NULL)
return;
left = parent->left;
right = parent->right;
if (right != NULL)
free(right);
free_tree(parent->left);
free_tree(parent->right);
free(parent);
parent = left;
}
}
long get_file_size(FILE *file)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment