summaryrefslogtreecommitdiff
path: root/src/bin/e_start_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/e_start_main.c')
-rw-r--r--src/bin/e_start_main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/bin/e_start_main.c b/src/bin/e_start_main.c
index b4e4d9f58..18d4cebbd 100644
--- a/src/bin/e_start_main.c
+++ b/src/bin/e_start_main.c
@@ -75,10 +75,13 @@ env_set(const char *var, const char *val)
75 char *buf; 75 char *buf;
76 size_t size = strlen(var) + 1 + strlen(val) + 1; 76 size_t size = strlen(var) + 1 + strlen(val) + 1;
77 77
78 buf = alloca(size); 78 // yes - this does leak. we know. intentional if we set the same
79 // env multiple times because we likely won't and alloca is wrong
80 // as we lose the env content on the stack. but becomes part of
81 // the environment so it has to stay around after putenv is called
82 buf = malloc(size);
79 sprintf(buf, "%s=%s", var, val); 83 sprintf(buf, "%s=%s", var, val);
80 if (getenv(var)) putenv(buf); 84 putenv(buf);
81 else putenv(strdup(buf));
82#endif 85#endif
83 } 86 }
84 else 87 else