From 12b813b5895cae579e403dafe43878868f27fe0f Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 22 Jan 2015 20:20:15 +0000 Subject: 34331: better handling of NULL in cd. Problem was return from symbolic link expander in weird cases where there file system isn't behaving itself properly. --- Src/builtin.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Src/builtin.c') diff --git a/Src/builtin.c b/Src/builtin.c index 1818941b2..08be1acdd 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -1156,9 +1156,11 @@ cd_new_pwd(int func, LinkNode dir, int quiet) zsfree(getlinknode(dirstack)); if (chasinglinks) { - s = new_pwd; - new_pwd = findpwd(s); - zsfree(s); + s = findpwd(new_pwd); + if (s) { + zsfree(new_pwd); + new_pwd = s; + } } if (isset(PUSHDIGNOREDUPS)) { LinkNode n; -- cgit 1.4.1