Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 'cd' built-in crashed zsh on a broken file system



On Sat, 24 Jan 2015 20:09:14 +0100
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> This ztrdup triggered a couple of errors in valgrind. Since everything
> else returned from getnameddir seems to be heap allocated, should this
> be dupstring instead?

Yes, it was mimicking the ztrdup() further up but that gets explicitly
freed in the other branch.

diff --git a/Src/utils.c b/Src/utils.c
index cf18f12..0490df5 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1114,7 +1114,7 @@ getnameddir(char *name)
 		zsfree(dir);
 		return str;
 	    } else
-		return ztrdup(pw->pw_dir);
+		return dupstring(pw->pw_dir);
 	}
     }
 #endif /* HAVE_GETPWNAM */


pws



Messages sorted by: Reverse Date, Date, Thread, Author