Commit ba877377f762d4309c4cb1e7df584a1bb8d0a6a8

Thomas de Grivel 2024-01-22T23:03:05

wip asan

diff --git a/libc3/env.c b/libc3/env.c
index 2249592..6d127e4 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -717,7 +717,7 @@ bool env_eval_struct (s_env *env, const s_struct *s, s_tag *dest)
   }
   *dest = tmp;
   return true;
-    ko_tag:
+ ko_tag:
   tag_clean(&tag);
  ko:
   struct_clean(t);
diff --git a/libc3/struct.c b/libc3/struct.c
index b044893..7f0463f 100644
--- a/libc3/struct.c
+++ b/libc3/struct.c
@@ -47,14 +47,14 @@ void struct_clean (s_struct *s)
   const s_sym *sym;
   assert(s);
   assert(s->type);
-  if (! s->type->must_clean)
-    return;
   if (s->data) {
-    i = 0;
-    while (i < s->type->map.count) {
-      if (tag_type(s->type->map.value + i, &sym))
-        data_clean(sym, (s8 *) s->data + s->type->offset[i]);
-      i++;
+    if (s->type->must_clean) {
+      i = 0;
+      while (i < s->type->map.count) {
+        if (tag_type(s->type->map.value + i, &sym))
+          data_clean(sym, (s8 *) s->data + s->type->offset[i]);
+        i++;
+      }
     }
     if (s->free_data)
       free(s->data);