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:
authorChristopher Faylor <me@cgf.cx>2002-01-06 06:32:32 +0300
committerChristopher Faylor <me@cgf.cx>2002-01-06 06:32:32 +0300
commit9125cbd7cf47b848390294897561c556a8d8b572 (patch)
tree5e30b22d3069e54636ab0d4b77a5ffcf551bb230 /winsup/cygwin/dir.cc
parentfcb76c5dcb8f99207c876b64d12891945795596f (diff)
* dir.cc (opendir): Guarantee release of alloced fhandler structure on error.
Diffstat (limited to 'winsup/cygwin/dir.cc')
-rw-r--r--winsup/cygwin/dir.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
index 44db5d7be..40411b48c 100644
--- a/winsup/cygwin/dir.cc
+++ b/winsup/cygwin/dir.cc
@@ -88,14 +88,16 @@ opendir (const char *name)
PC_SYM_FOLLOW | PC_FULL, NULL);
if (!fh)
res = NULL;
- else if (!pc.exists ())
- set_errno (ENOENT);
+ else if (pc.exists ())
+ res = fh->opendir (pc);
else
{
- res = fh->opendir (pc);
- if (!res)
- delete fh;
+ set_errno (ENOENT);
+ res = NULL;
}
+
+ if (!res && fh)
+ delete fh;
return res;
}