diff --git a/zsh-5.0.7-cd-sigsegv.patch b/zsh-5.0.7-cd-sigsegv.patch
index 7ad5e0f..f260021 100644
--- a/zsh-5.0.7-cd-sigsegv.patch
+++ b/zsh-5.0.7-cd-sigsegv.patch
@@ -1,7 +1,7 @@
From 19c75aec6843b827fa7ef3f39174090ee7f8ac18 Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Thu, 22 Jan 2015 20:20:15 +0000
-Subject: [PATCH] 34331: better handling of NULL in cd.
+Subject: [PATCH 1/2] 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.
@@ -57,3 +57,31 @@ index e6eb8e6..80396a2 100644
--
2.1.0
+
+From d0777e66d47d0a87f3171962d8137a6cb75d7ade Mon Sep 17 00:00:00 2001
+From: Peter Stephenson
+Date: Sun, 25 Jan 2015 18:03:20 +0000
+Subject: [PATCH 2/2] 34383: ztrdup() should be dupstring() in new cd code
+
+Upstream-commit: ccd3663d4e9a1749450b35cc689359f78a310c04
+Signed-off-by: Kamil Dudka
+---
+ Src/utils.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Src/utils.c b/Src/utils.c
+index 80396a2..ef71210 100644
+--- a/Src/utils.c
++++ b/Src/utils.c
+@@ -1055,7 +1055,7 @@ getnameddir(char *name)
+ zsfree(dir);
+ return str;
+ } else
+- return ztrdup(pw->pw_dir);
++ return dupstring(pw->pw_dir);
+ }
+ }
+ #endif /* HAVE_GETPWNAM */
+--
+2.1.0
+
diff --git a/zsh.spec b/zsh.spec
index 41d9e22..88d3fd1 100644
--- a/zsh.spec
+++ b/zsh.spec
@@ -3,7 +3,7 @@
Summary: Powerful interactive shell
Name: zsh
Version: 5.0.7
-Release: 5%{?dist}
+Release: 6%{?dist}
License: MIT
URL: http://zsh.sourceforge.net/
Group: System Environment/Shells
@@ -185,6 +185,9 @@ fi
%doc Doc/*.html
%changelog
+* Sun Jan 25 2015 Kamil Dudka - 5.0.7-6
+- use correct allocation function in the new 'cd' code (#1183238)
+
* Fri Jan 23 2015 Kamil Dudka - 5.0.7-5
- suppress a warning about closing an already closed file descriptor (#1184002)
- improve handling of NULL in the 'cd' built-in (#1183238)