mufs: implement mufs_del_tree() to safely free tree objects from memory
This commit is contained in:
parent
07cd243603
commit
4ed40e75c6
2 changed files with 16 additions and 0 deletions
|
@ -12,6 +12,21 @@
|
|||
#include "dir.h"
|
||||
#include "tree.h"
|
||||
|
||||
void mufs_del_tree(struct mufs_tree *tree)
|
||||
{
|
||||
struct mufs *fs;
|
||||
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
fs = tree->fs;
|
||||
|
||||
if (tree == &fs->root)
|
||||
return;
|
||||
|
||||
free(tree);
|
||||
}
|
||||
|
||||
static int mufs_do_lookup(struct mufs *fs, uint32_t *page,
|
||||
uint32_t base, uint8_t depth, uint32_t va, uint32_t new_page,
|
||||
unsigned alloc)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
void mufs_del_tree(struct mufs_tree *tree);
|
||||
int mufs_lookup_page(struct mufs_tree *tree, uint32_t *page,
|
||||
uint32_t va);
|
||||
int mufs_map_page(struct mufs_tree *tree, uint32_t va, uint32_t page);
|
||||
|
|
Loading…
Add table
Reference in a new issue