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) ...@@ -55,6 +55,8 @@ static int read_entry(struct BIT_BUFFER *bitbuf, struct tree *parent)
free(c); free(c);
} }
free(bit);
return 0; return 0;
} }
......
...@@ -11,18 +11,13 @@ ...@@ -11,18 +11,13 @@
void free_tree(struct tree *parent) void free_tree(struct tree *parent)
{ {
while (parent != NULL) { if (parent == NULL)
struct tree *left, *right; return;
left = parent->left; free_tree(parent->left);
right = parent->right; free_tree(parent->right);
if (right != NULL)
free(right);
free(parent); free(parent);
parent = left;
}
} }
long get_file_size(FILE *file) 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