summaryrefslogtreecommitdiff
path: root/Src/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index e9e8e3bff..6dbd1597f 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -805,6 +805,7 @@ bin_cd(char *nam, char **argv, Options ops, int func)
if (stat(unmeta(pwd), &st1) < 0) {
setjobpwd();
zsfree(pwd);
+ pwd = NULL;
pwd = metafy(zgetcwd(), -1, META_DUP);
} else if (stat(".", &st2) < 0) {
if (chdir(unmeta(pwd)) < 0)
@@ -813,6 +814,7 @@ bin_cd(char *nam, char **argv, Options ops, int func)
if (chasinglinks) {
setjobpwd();
zsfree(pwd);
+ pwd = NULL;
pwd = metafy(zgetcwd(), -1, META_DUP);
} else if (chdir(unmeta(pwd)) < 0)
zwarn("unable to chdir(%s): %e", pwd, errno);