Commit 5634e783565b6293a966e271acc7539cd89fd1c6

Thomas de Grivel 2023-12-01T13:38:05

wip asan

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/libc3/env.c b/libc3/env.c
index c36860b..bc2782a 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -790,8 +790,11 @@ s_env * env_init_args (s_env *env, int argc, s8 **argv)
     file_dirname(&argv0, &dir);
     buf_init(&buf, false, sizeof(a), a);
     if ((r = buf_write_str(&buf, &dir)) < 0 ||
-        (r = buf_write_u8(&buf, '/') < 0))
+        (r = buf_write_u8(&buf, '/') < 0)) {
+      str_clean(&dir);
       goto ko;
+    }
+    str_clean(&dir);
     buf_read_to_str(&buf, &env->argv0_dir);
     return env;
   }