avoid talloc abort in simtrace2 frontend_append_script_env()
talloc requires a valid context for the allocation, we cannot use
env[i] as context.
Change-Id: I82b5e6b91b39d6f5c2a7492adb8c6193083e0d70
diff --git a/src/client/main_fsm.c b/src/client/main_fsm.c
index 0674f6c..673b19e 100644
--- a/src/client/main_fsm.c
+++ b/src/client/main_fsm.c
@@ -75,9 +75,9 @@
env[i++] = talloc_asprintf(env, "REMSIM_CAUSE=%s", cause);
/* ask frontend to append any frontend-speccific additional environment vars */
- rc = frontend_append_script_env(bc, env+i, 256-i);
+ rc = frontend_append_script_env(bc, env, i, 256-i-1);
if (rc > 0)
- i += rc;
+ i = rc;
/* terminate last entry */
env[i++] = NULL;