diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-03-27 11:29:56 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-03-27 11:29:56 +0000 |
commit | 7a9f309bcd79ecfe3af91680cd14098feaf1195e (patch) | |
tree | 1755f22e10334bb3bcc92dff6eabf6744e7152d4 /winsup/cygwin/syscalls.cc | |
parent | d6e045e61417e0284b0ba4f9b75d5538980c4275 (diff) | |
download | cygnal-7a9f309bcd79ecfe3af91680cd14098feaf1195e.tar.gz cygnal-7a9f309bcd79ecfe3af91680cd14098feaf1195e.tar.bz2 cygnal-7a9f309bcd79ecfe3af91680cd14098feaf1195e.zip |
* syscalls.cc (pathconf): Fix memory leak.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index af26e008b..7950299ca 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -2047,10 +2047,12 @@ extern "C" long int pathconf (const char *file, int v) { fhandler_base *fh; + long ret = -1; myfault efault; if (efault.faulted (EFAULT)) return -1; + if (!*file) { set_errno (ENOENT); @@ -2059,11 +2061,11 @@ pathconf (const char *file, int v) if (!(fh = build_fh_name (file, NULL, PC_SYM_FOLLOW, stat_suffixes))) return -1; if (!fh->exists ()) - { - set_errno (ENOENT); - return -1; - } - return fh->fpathconf (v); + set_errno (ENOENT); + else + ret = fh->fpathconf (v); + delete fh; + return ret; } extern "C" int |