diff options
author | Christopher Faylor <me@cgf.cx> | 2002-01-06 03:32:32 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-01-06 03:32:32 +0000 |
commit | 9125cbd7cf47b848390294897561c556a8d8b572 (patch) | |
tree | 5e30b22d3069e54636ab0d4b77a5ffcf551bb230 /winsup/cygwin/dir.cc | |
parent | fcb76c5dcb8f99207c876b64d12891945795596f (diff) | |
download | cygnal-9125cbd7cf47b848390294897561c556a8d8b572.tar.gz cygnal-9125cbd7cf47b848390294897561c556a8d8b572.tar.bz2 cygnal-9125cbd7cf47b848390294897561c556a8d8b572.zip |
* dir.cc (opendir): Guarantee release of alloced fhandler structure on error.
Diffstat (limited to 'winsup/cygwin/dir.cc')
-rw-r--r-- | winsup/cygwin/dir.cc | 12 |
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; } |