Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/syscalls.cc12
2 files changed, 11 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 018a5f96d..6a8612b30 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2009-03-27 Corinna Vinschen <corinna@vinschen.de>
+
+ * syscalls.cc (pathconf): Fix memory leak.
+
2009-03-26 Corinna Vinschen <corinna@vinschen.de>
* path.cc (symlink_worker): Write target filename as UTF-16 string
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