Commit a40127e20c865cfb5491dd0be29753221719f451

Thomas de Grivel 2024-09-18T10:40:06

fix memleak in fn frame

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/libkc3/env.c b/libkc3/env.c
index f78a4e4..f6b9374 100644
--- a/libkc3/env.c
+++ b/libkc3/env.c
@@ -1281,7 +1281,8 @@ bool env_eval_fn (s_env *env, const s_fn *fn, s_tag *dest)
     return false;
   if (! tmp.data.fn.module)
     tmp.data.fn.module = env->current_defmodule;
-  if (! (tmp.data.fn.frame = frame_new_copy(env->frame)))
+  if (! tmp.data.fn.frame &&
+      ! (tmp.data.fn.frame = frame_new_copy(env->frame)))
     return false;
   *dest = tmp;
   return true;