runtime: fix memory leaks

This commit is contained in:
2026-05-30 19:52:36 +01:00
parent 26b368a512
commit 96bf76aabc
9 changed files with 75 additions and 19 deletions
+11 -4
View File
@@ -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;
}