bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

memleak in sh_realpath


From: Eric Blake
Subject: memleak in sh_realpath
Date: Sat, 27 Aug 2005 14:44:11 -0600
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Looking at lib/sh/pathphys.c, it looks like sh_realpath() has a memory
leak.  Line 288 copies wd into resolved, then returns resolved without
ever freeing wd.  Meanwhile, for systems that provide POSIX realpath(3)
with the additional semantics that realpath (path, NULL) malloc's the
result, why not implement sh_physpath as a call to realpath?  In
particular, cygwin is one of these systems, so you could remove all the
__CYGWIN__ hacks about checking for drive letters in favor of calling
realpath, which on cygwin does the right thing in the presence of drive
letters.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDENCb84KuGfSFAYARAouBAKCd5uEfbT8jC/Y7ZPyb+rGQA4J8rwCgteKy
r/mwaPUwwiSipKmNPBEH+9w=
=NiJh
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]