Commit c2e9f7619dea7a6a3c90718e64415ae67c389de4

Thomas de Grivel 2024-05-17T14:21:45

fix cow_init_cast

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/libc3/cow.c b/libc3/cow.c
index 0fb2b5a..e600545 100644
--- a/libc3/cow.c
+++ b/libc3/cow.c
@@ -107,12 +107,14 @@ s_cow * cow_init_cast (s_cow *cow, const s_sym * const *type,
     return NULL;
   }
   tmp.type = *type;
+  tmp.list = list_new(NULL);
   if (! sym_to_tag_type(*type, &tmp.list->tag.type))
     return NULL;
   if (! tag_to_pointer(&tmp.list->tag, *type, &data))
     return NULL;
   if (! data_init_cast(data, type, tag))
     return NULL;
+  cow_freeze(&tmp);
   *cow = tmp;
   return cow;
 }