diff --git a/cmd-string.c b/cmd-string.c index 1e471081..a5c5dd12 100644 --- a/cmd-string.c +++ b/cmd-string.c @@ -63,7 +63,7 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause) if ((t = strchr(s, ' ')) == NULL && (t = strchr(s, '\t')) == NULL) t = strchr(s, '\0'); if ((u = strchr(s, '=')) != NULL && u < t) { - if (putenv((char *) s) != 0) { + if (putenv(xstrdup(s)) != 0) { xasprintf(cause, "assignment failed: %s", s); return (-1); } diff --git a/window.c b/window.c index 06733201..aeed4bc9 100644 --- a/window.c +++ b/window.c @@ -473,7 +473,7 @@ window_pane_spawn(struct window_pane *wp, if (chdir(wp->cwd) != 0) chdir("/"); for (envq = envp; *envq != NULL; envq++) { - if (putenv((char *) *envq) != 0) + if (putenv(xstrdup(*envq)) != 0) fatal("putenv failed"); } sigreset();