runtime: fix memory leaks
This commit is contained in:
@@ -1,7 +1,16 @@
|
||||
#include "var-map.h"
|
||||
|
||||
static void var_entry_cleanup(fx_namemap_entry *entry)
|
||||
{
|
||||
struct var_map_entry *map_entry
|
||||
= fx_unbox(struct var_map_entry, entry, e_entry);
|
||||
bshell_variable_unref(map_entry->e_var);
|
||||
free(map_entry);
|
||||
}
|
||||
|
||||
void var_map_cleanup(struct var_map *map)
|
||||
{
|
||||
fx_namemap_cleanup(&map->m_vars, var_entry_cleanup);
|
||||
}
|
||||
|
||||
enum bshell_status var_map_put(struct var_map *map, bshell_variable *var)
|
||||
@@ -27,9 +36,7 @@ bshell_variable *var_map_get(struct var_map *map, const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct var_map_entry *entry = fx_unbox(
|
||||
struct var_map_entry,
|
||||
e,
|
||||
e_entry);
|
||||
struct var_map_entry *entry
|
||||
= fx_unbox(struct var_map_entry, e, e_entry);
|
||||
return entry->e_var;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user