Commit 590721cf38b85563e27e5eb505a532aafed4ba39

Thomas de Grivel 2023-09-19T17:11:24

tmp.data

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/libc3/env.c b/libc3/env.c
index 0777515..b8e6e82 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -109,11 +109,12 @@ bool env_eval_array (s_env *env, const s_array *array, s_tag *dest)
   array_copy(array, &tmp);
   size = tmp.dimensions[tmp.dimension - 1].item_size;
   if (! tmp.data &&
-      ! (data = tmp.data = calloc(tmp.dimensions[0].count,
-                                  tmp.dimensions[0].item_size))) {
+      ! (tmp.data = calloc(tmp.dimensions[0].count,
+                           tmp.dimensions[0].item_size))) {
     assert(! "env_eval_array: out of memory");
     errx(1, "env_eval_array: out of memory");
   }
+  data = tmp.data;
   tag = tmp.tags;
   while (i < tmp.count) {
     env_eval_array_cast(env, &tmp, tag, data, size);