zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: 'cd' built-in crashed zsh on a broken file system
Date: Sun, 25 Jan 2015 17:54:47 +0000	[thread overview]
Message-ID: <20150125175447.717d947f@ntlworld.com> (raw)
In-Reply-To: <CAHYJk3Qey1gXZ=8d1_FZbYQ2pFd2DHS_eZ-ceP5=JoaOyB+-6A@mail.gmail.com>

On Sat, 24 Jan 2015 20:09:14 +0100
Mikael Magnusson <mikachu@gmail.com> 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


      parent reply	other threads:[~2015-01-25 18:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20 12:35 Kamil Dudka
2015-01-20 18:28 ` Bart Schaefer
2015-01-20 20:34   ` Peter Stephenson
2015-01-20 21:57     ` Bart Schaefer
2015-01-23 13:31     ` Kamil Dudka
2015-01-24 19:09     ` Mikael Magnusson
2015-01-24 21:56       ` Mikael Magnusson
2015-01-25  3:54       ` Bart Schaefer
2015-01-25 17:54       ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150125175447.717d947f@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).