Commit 2f16b6c653757ec79d899ab22fbdc80d9e6ff4cc

Thomas de Grivel 2023-09-07T11:15:03

wip asan

diff --git a/libc3/env.c b/libc3/env.c
index ea04417..2ee6d9e 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -664,17 +664,25 @@ bool env_module_maybe_reload (s_env *env, const s_sym *name,
                               s_facts *facts)
 {
   s_str path;
+  bool r = true;
   s_tag tag_load_time;
   s_tag tag_mtime;
   if (! module_load_time(name, facts, &tag_load_time))
     return false;
-  if (! module_name_path(&env->module_path, name, &path))
-    return false;
-  if (! file_mtime(&path, &tag_mtime))
+  if (! module_name_path(&env->module_path, name, &path)) {
+    tag_clean(&tag_load_time);
     return false;
+  }
+  if (! file_mtime(&path, &tag_mtime)) {
+    r = false;
+    goto clean;
+  }
   if (compare_tag(&tag_load_time, &tag_mtime) < 0)
-    return module_load(name, facts);
-  return true;
+    r = module_load(name, facts);
+ clean:
+  str_clean(&path);
+  tag_clean(&tag_load_time);
+  return r;
 }
 
 bool env_operator_is_binary (s_env *env, const s_ident *op)